@@ -6,15 +6,14 @@ use std::mem;
66
77use rustc_ast:: attr:: AttributeExt ;
88use rustc_ast:: expand:: StrippedCfgItem ;
9- use rustc_ast:: { self as ast, Crate , Inline , ItemKind , ModKind , NodeId , attr} ;
9+ use rustc_ast:: { self as ast, Crate , NodeId , attr} ;
1010use rustc_ast_pretty:: pprust;
1111use rustc_attr_parsing:: StabilityLevel ;
1212use rustc_data_structures:: intern:: Interned ;
1313use rustc_data_structures:: sync:: Lrc ;
1414use rustc_errors:: { Applicability , StashKey } ;
1515use rustc_expand:: base:: {
16- Annotatable , DeriveResolution , Indeterminate , ResolverExpand , SyntaxExtension ,
17- SyntaxExtensionKind ,
16+ DeriveResolution , Indeterminate , ResolverExpand , SyntaxExtension , SyntaxExtensionKind ,
1817} ;
1918use rustc_expand:: compile_declarative_macro;
2019use rustc_expand:: expand:: {
@@ -26,8 +25,8 @@ use rustc_middle::middle::stability;
2625use rustc_middle:: ty:: { RegisteredTools , TyCtxt , Visibility } ;
2726use rustc_session:: lint:: BuiltinLintDiag ;
2827use rustc_session:: lint:: builtin:: {
29- LEGACY_DERIVE_HELPERS , OUT_OF_SCOPE_MACRO_CALLS , SOFT_UNSTABLE ,
30- UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES , UNUSED_MACRO_RULES , UNUSED_MACROS ,
28+ LEGACY_DERIVE_HELPERS , OUT_OF_SCOPE_MACRO_CALLS , UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
29+ UNUSED_MACRO_RULES , UNUSED_MACROS ,
3130} ;
3231use rustc_session:: parse:: feature_err;
3332use rustc_span:: edit_distance:: edit_distance;
@@ -157,26 +156,6 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools {
157156 registered_tools
158157}
159158
160- // Some feature gates for inner attributes are reported as lints for backward compatibility.
161- fn soft_custom_inner_attributes_gate ( path : & ast:: Path , invoc : & Invocation ) -> bool {
162- match & path. segments [ ..] {
163- // `#![test]`
164- [ seg] if seg. ident . name == sym:: test => return true ,
165- // `#![rustfmt::skip]` on out-of-line modules
166- [ seg1, seg2] if seg1. ident . name == sym:: rustfmt && seg2. ident . name == sym:: skip => {
167- if let InvocationKind :: Attr { item, .. } = & invoc. kind {
168- if let Annotatable :: Item ( item) = item {
169- if let ItemKind :: Mod ( _, ModKind :: Loaded ( _, Inline :: No , _, _) ) = item. kind {
170- return true ;
171- }
172- }
173- }
174- }
175- _ => { }
176- }
177- false
178- }
179-
180159impl < ' ra , ' tcx > ResolverExpand for Resolver < ' ra , ' tcx > {
181160 fn next_node_id ( & mut self ) -> NodeId {
182161 self . next_node_id ( )
@@ -317,7 +296,6 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
317296 parent_scope,
318297 node_id,
319298 force,
320- soft_custom_inner_attributes_gate ( path, invoc) ,
321299 deleg_impl,
322300 looks_like_invoc_in_mod_inert_attr,
323301 ) ?;
@@ -549,7 +527,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
549527 parent_scope : & ParentScope < ' ra > ,
550528 node_id : NodeId ,
551529 force : bool ,
552- soft_custom_inner_attributes_gate : bool ,
553530 deleg_impl : Option < LocalDefId > ,
554531 invoc_in_mod_inert_attr : Option < LocalDefId > ,
555532 ) -> Result < ( Lrc < SyntaxExtension > , Res ) , Indeterminate > {
@@ -667,22 +644,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
667644 Res :: NonMacroAttr ( ..) => false ,
668645 _ => unreachable ! ( ) ,
669646 } ;
670- if soft_custom_inner_attributes_gate {
671- self . tcx . sess . psess . buffer_lint (
672- SOFT_UNSTABLE ,
673- path. span ,
674- node_id,
675- BuiltinLintDiag :: InnerAttributeUnstable { is_macro } ,
676- ) ;
647+ let msg = if is_macro {
648+ "inner macro attributes are unstable"
677649 } else {
678- // FIXME: deduplicate with rustc_lint (`BuiltinLintDiag::InnerAttributeUnstable`)
679- let msg = if is_macro {
680- "inner macro attributes are unstable"
681- } else {
682- "custom inner attributes are unstable"
683- } ;
684- feature_err ( & self . tcx . sess , sym:: custom_inner_attributes, path. span , msg) . emit ( ) ;
685- }
650+ "custom inner attributes are unstable"
651+ } ;
652+ feature_err ( & self . tcx . sess , sym:: custom_inner_attributes, path. span , msg) . emit ( ) ;
686653 }
687654
688655 if res == Res :: NonMacroAttr ( NonMacroAttrKind :: Tool )
0 commit comments