@@ -5,15 +5,14 @@ use std::cell::Cell;
5
5
use std:: mem;
6
6
7
7
use rustc_ast:: expand:: StrippedCfgItem ;
8
- use rustc_ast:: { self as ast, Crate , Inline , ItemKind , ModKind , NodeId , attr} ;
8
+ use rustc_ast:: { self as ast, Crate , NodeId , attr} ;
9
9
use rustc_ast_pretty:: pprust;
10
10
use rustc_attr:: StabilityLevel ;
11
11
use rustc_data_structures:: intern:: Interned ;
12
12
use rustc_data_structures:: sync:: Lrc ;
13
13
use rustc_errors:: { Applicability , StashKey } ;
14
14
use rustc_expand:: base:: {
15
- Annotatable , DeriveResolution , Indeterminate , ResolverExpand , SyntaxExtension ,
16
- SyntaxExtensionKind ,
15
+ DeriveResolution , Indeterminate , ResolverExpand , SyntaxExtension , SyntaxExtensionKind ,
17
16
} ;
18
17
use rustc_expand:: compile_declarative_macro;
19
18
use rustc_expand:: expand:: {
@@ -25,8 +24,8 @@ use rustc_middle::middle::stability;
25
24
use rustc_middle:: ty:: { RegisteredTools , TyCtxt , Visibility } ;
26
25
use rustc_session:: lint:: BuiltinLintDiag ;
27
26
use rustc_session:: lint:: builtin:: {
28
- LEGACY_DERIVE_HELPERS , OUT_OF_SCOPE_MACRO_CALLS , SOFT_UNSTABLE ,
29
- UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES , UNUSED_MACRO_RULES , UNUSED_MACROS ,
27
+ LEGACY_DERIVE_HELPERS , OUT_OF_SCOPE_MACRO_CALLS , UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES ,
28
+ UNUSED_MACRO_RULES , UNUSED_MACROS ,
30
29
} ;
31
30
use rustc_session:: parse:: feature_err;
32
31
use rustc_span:: edit_distance:: edit_distance;
@@ -157,26 +156,6 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools {
157
156
registered_tools
158
157
}
159
158
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
-
180
159
impl < ' ra , ' tcx > ResolverExpand for Resolver < ' ra , ' tcx > {
181
160
fn next_node_id ( & mut self ) -> NodeId {
182
161
self . next_node_id ( )
@@ -317,7 +296,6 @@ impl<'ra, 'tcx> ResolverExpand for Resolver<'ra, 'tcx> {
317
296
parent_scope,
318
297
node_id,
319
298
force,
320
- soft_custom_inner_attributes_gate ( path, invoc) ,
321
299
deleg_impl,
322
300
looks_like_invoc_in_mod_inert_attr,
323
301
) ?;
@@ -549,7 +527,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
549
527
parent_scope : & ParentScope < ' ra > ,
550
528
node_id : NodeId ,
551
529
force : bool ,
552
- soft_custom_inner_attributes_gate : bool ,
553
530
deleg_impl : Option < LocalDefId > ,
554
531
invoc_in_mod_inert_attr : Option < LocalDefId > ,
555
532
) -> Result < ( Lrc < SyntaxExtension > , Res ) , Indeterminate > {
@@ -667,22 +644,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
667
644
Res :: NonMacroAttr ( ..) => false ,
668
645
_ => unreachable ! ( ) ,
669
646
} ;
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"
677
649
} 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 ( ) ;
686
653
}
687
654
688
655
if res == Res :: NonMacroAttr ( NonMacroAttrKind :: Tool )
0 commit comments