You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you've arrived here because you encountered a feature gate warning for unstable syntax behind #[cfg(…)], here's how you can transform your code while keeping the unstable syntax cfg-conditional:
Before (triggers a feature gate warning):
#[cfg(feature = "nightly")]// or a different cfg-conditionimpl !TraitforType{}// or a different unstable syntax
After (first approach) (idiomatic, doesn't trigger a warning):
After (second approach) (idiomatic, doesn't trigger a warning):
macro_rules! generate {// Of course, you can use macro metavariables to avoid code duplication etc.() => {impl !TraitforType{}}}#[cfg(feature = "nightly")]generate!();
Tip
If you've arrived here because you encountered a feature gate warning for unstable syntax behind
#[cfg(…)], here's how you can transform your code while keeping the unstable syntaxcfg-conditional:Before (triggers a feature gate warning):
After (first approach) (idiomatic, doesn't trigger a warning):
After (second approach) (idiomatic, doesn't trigger a warning):
If you'd like to see a more realistic example, head on over to https://github.com/arcnmx/packed-rs/pull/1/changes.
Steps
For all the other ones that also don't emit a pre-expansion warning yet, add warnings immediately(done)no further input from T-compiler/T-lang should be needed since it's already legitimized by MCP 535.Affected Syntactic Constructs
default(featurespecializationormin_specializationfor fns only)!(featurenegative_impls)try { … }(featuretry_blocks)box $pat(featurebox_patterns)$patpath { box $ident }, pseudo binding mode (featurebox_patterns)trait $ident $genericparams = $bounds;(featuretrait_alias)auto(featureauto_traits)impl $traitref for .. {}(early version of a now removed predecessor of featureauto_traits)macro $ident$macroparams { $ttstar }(featuredecl_macro)$ty = $tyand$ty == $ty(no corresp. feature was ever added (cc RUST-22074, RUST-87471))Pre-History (Incomplete)
autotraits pre-expansion #116393impl Trait for ..syntax #121072Implementation History
box'ed struct field patterns #154475Downstream Patches