@@ -22,7 +22,7 @@ use rustc_hir::def::{self, DefKind, NonMacroAttrKind};
2222use rustc_hir:: def_id;
2323use rustc_middle:: middle:: stability;
2424use rustc_middle:: ty;
25- use rustc_session:: lint:: builtin:: UNUSED_MACROS ;
25+ use rustc_session:: lint:: builtin:: { SOFT_UNSTABLE , UNUSED_MACROS } ;
2626use rustc_session:: parse:: feature_err;
2727use rustc_session:: Session ;
2828use rustc_span:: edition:: Edition ;
@@ -459,22 +459,21 @@ impl<'a> Resolver<'a> {
459459 }
460460
461461 // We are trying to avoid reporting this error if other related errors were reported.
462- if inner_attr
462+ if res != Res :: Err
463+ && inner_attr
463464 && !self . session . features_untracked ( ) . custom_inner_attributes
464- && path != & sym:: test
465- && res != Res :: Err
466465 {
467- feature_err (
468- & self . session . parse_sess ,
469- sym :: custom_inner_attributes ,
470- path . span ,
471- match res {
472- Res :: Def ( .. ) => "inner macro attributes are unstable" ,
473- Res :: NonMacroAttr ( .. ) => "custom inner attributes are unstable" ,
474- _ => unreachable ! ( ) ,
475- } ,
476- )
477- . emit ( ) ;
466+ let msg = match res {
467+ Res :: Def ( .. ) => "inner macro attributes are unstable" ,
468+ Res :: NonMacroAttr ( .. ) => "custom inner attributes are unstable" ,
469+ _ => unreachable ! ( ) ,
470+ } ;
471+ if path == & sym :: test {
472+ self . session . parse_sess . buffer_lint ( SOFT_UNSTABLE , path . span , node_id , msg ) ;
473+ } else {
474+ feature_err ( & self . session . parse_sess , sym :: custom_inner_attributes , path . span , msg )
475+ . emit ( ) ;
476+ }
478477 }
479478
480479 Ok ( ( ext, res) )
0 commit comments