pub static UNSTABLE_SYNTAX_PRE_EXPANSION: &'static Lint
Expand description

The unstable_syntax_pre_expansion lint detects the use of unstable syntax that is discarded during attribute expansion.

§Example

#[cfg(FALSE)]
macro foo() {}

{{produces}}

§Explanation

The input to active attributes such as #[cfg] or procedural macro attributes is required to be valid syntax. Previously, the compiler only gated the use of unstable syntax features after resolving #[cfg] gates and expanding procedural macros.

To avoid relying on unstable syntax, move the use of unstable syntax into a position where the compiler does not parse the syntax, such as a functionlike macro.


macro_rules! identity {
   ( $($tokens:tt)* ) => { $($tokens)* }
}

#[cfg(FALSE)]
identity! {
   macro foo() {}
}

This is a future-incompatible lint to transition this to a hard error in the future. See issue #65860 for more details.