Closed
Description
We had a situation in rust-lang/rust#46480 where we had trouble removing support for an unstable syntax in the parser because a popular crate (crossbeam) used the syntax behind a simple feature gate:
#[cfg(nightly)]
impl UnstableSyntax for .. {}
Because we only process cfg
s after parsing, the cfg
doesn't help at all in this case, causing de facto stability of the parser's support for unstable syntax. This situation is likely to repeat itself, we must teach lib authors to only use unstable syntax inside a mod that is cfg
ed at it's declaration, such as:
#[cfg(nightly)]
mod contains_unstable_syntax;
or behind a macro:
#[cfg(nightly)]
macro_rules unstable_syntax! { /* expand to unstable syntax */ }
#[cfg(not(nightly))]
macro_rules unstable_syntax! { /* expand to nothing */ }
Metadata
Metadata
Assignees
Labels
No labels