@@ -22,7 +22,7 @@ use rustc_hir::def::{self, DefKind, NonMacroAttrKind};
22
22
use rustc_hir:: def_id;
23
23
use rustc_middle:: middle:: stability;
24
24
use rustc_middle:: ty;
25
- use rustc_session:: lint:: builtin:: UNUSED_MACROS ;
25
+ use rustc_session:: lint:: builtin:: { SOFT_UNSTABLE , UNUSED_MACROS } ;
26
26
use rustc_session:: parse:: feature_err;
27
27
use rustc_session:: Session ;
28
28
use rustc_span:: edition:: Edition ;
@@ -459,22 +459,21 @@ impl<'a> Resolver<'a> {
459
459
}
460
460
461
461
// 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
463
464
&& !self . session . features_untracked ( ) . custom_inner_attributes
464
- && path != & sym:: test
465
- && res != Res :: Err
466
465
{
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
+ }
478
477
}
479
478
480
479
Ok ( ( ext, res) )
0 commit comments