@@ -54,8 +54,10 @@ macro_rules! declare_features {
5454 #[ derive( Clone , Default , Debug ) ]
5555 pub struct Features {
5656 /// `#![feature]` attrs for language features, for error reporting.
57+ /// "declared" here means that the feature is actually enabled in the current crate.
5758 pub declared_lang_features: Vec <( Symbol , Span , Option <Symbol >) >,
5859 /// `#![feature]` attrs for non-language (library) features.
60+ /// "declared" here means that the feature is actually enabled in the current crate.
5961 pub declared_lib_features: Vec <( Symbol , Span ) >,
6062 /// `declared_lang_features` + `declared_lib_features`.
6163 pub declared_features: FxHashSet <Symbol >,
@@ -125,9 +127,16 @@ macro_rules! declare_features {
125127 $(
126128 sym:: $feature => status_to_enum!( $status) == FeatureStatus :: Internal ,
127129 ) *
128- // Accepted/removed features aren't in this file but are never internal
129- // (a removed feature might have been internal, but that's now irrelevant).
130- _ if self . declared_features. contains( & feature) => false ,
130+ _ if self . declared_features. contains( & feature) => {
131+ // This could be accepted/removed, or a libs feature.
132+ // Accepted/removed features aren't in this file but are never internal
133+ // (a removed feature might have been internal, but that's now irrelevant).
134+ // Libs features are internal if they end in `_internal` or `_internals`.
135+ // We just always test the name; it's not a big deal if we accidentally hit
136+ // an accepted/removed lang feature that way.
137+ let name = feature. as_str( ) ;
138+ name. ends_with( "_internal" ) || name. ends_with( "_internals" )
139+ }
131140 _ => panic!( "`{}` was not listed in `declare_features`" , feature) ,
132141 }
133142 }
@@ -207,9 +216,6 @@ declare_features! (
207216 ( internal, test_2018_feature, "1.31.0" , None , Some ( Edition :: Edition2018 ) ) ,
208217 /// Added for testing unstable lints; perma-unstable.
209218 ( internal, test_unstable_lint, "1.60.0" , None , None ) ,
210- /// Allows non-`unsafe` —and thus, unsound— access to `Pin` constructions.
211- /// Marked `internal` since perma-unstable and unsound.
212- ( internal, unsafe_pin_internals, "1.60.0" , None , None ) ,
213219 /// Use for stable + negative coherence and strict coherence depending on trait's
214220 /// rustc_strict_coherence value.
215221 ( unstable, with_negative_coherence, "1.60.0" , None , None ) ,
0 commit comments