@@ -855,25 +855,19 @@ impl UnstableFeatures {
855855 pub fn is_nightly_build ( & self ) -> bool {
856856 match * self {
857857 UnstableFeatures :: Allow | UnstableFeatures :: Cheat => true ,
858- _ => false ,
858+ UnstableFeatures :: Disallow => false ,
859859 }
860860 }
861861}
862862
863863fn maybe_stage_features ( span_handler : & Handler , krate : & ast:: Crate , unstable : UnstableFeatures ) {
864- let allow_features = match unstable {
865- UnstableFeatures :: Allow => true ,
866- UnstableFeatures :: Disallow => false ,
867- UnstableFeatures :: Cheat => true
868- } ;
869- if !allow_features {
870- for attr in & krate. attrs {
871- if attr. check_name ( sym:: feature) {
872- let release_channel = option_env ! ( "CFG_RELEASE_CHANNEL" ) . unwrap_or ( "(unknown)" ) ;
873- span_err ! ( span_handler, attr. span, E0554 ,
874- "`#![feature]` may not be used on the {} release channel" ,
875- release_channel) ;
876- }
864+ if !unstable. is_nightly_build ( ) {
865+ for attr in krate. attrs . iter ( ) . filter ( |attr| attr. check_name ( sym:: feature) ) {
866+ span_err ! (
867+ span_handler, attr. span, E0554 ,
868+ "`#![feature]` may not be used on the {} release channel" ,
869+ option_env!( "CFG_RELEASE_CHANNEL" ) . unwrap_or( "(unknown)" )
870+ ) ;
877871 }
878872 }
879873}
0 commit comments