diff --git a/components/salsa-macro-rules/src/setup_tracked_fn.rs b/components/salsa-macro-rules/src/setup_tracked_fn.rs index 3c85af7..79ec96d 100644 --- a/components/salsa-macro-rules/src/setup_tracked_fn.rs +++ b/components/salsa-macro-rules/src/setup_tracked_fn.rs @@ -67,11 +67,6 @@ macro_rules! setup_tracked_fn { $inner:ident, ] ) => { - #[allow(non_camel_case_types)] - $vis struct $fn_name { - _priv: std::convert::Infallible, - } - // Suppress this clippy lint because we sometimes require `'db` where the ordinary Rust rules would not. #[allow(clippy::needless_lifetimes)] $(#[$attr])* @@ -288,5 +283,12 @@ macro_rules! setup_tracked_fn { } }) } + // The struct needs be last in the macro expansion in order to make the tracked + // function's ident be identified as a function, not a struct, during semantic highlighting. + // for more details, see https://github.com/salsa-rs/salsa/pull/612. + #[allow(non_camel_case_types)] + $vis struct $fn_name { + _priv: std::convert::Infallible, + } }; }