@@ -9,7 +9,7 @@ use std::cell::Cell;
9
9
use std:: collections:: hash_map:: Entry ;
10
10
11
11
use rustc_abi:: { Align , ExternAbi , Size } ;
12
- use rustc_ast:: { AttrStyle , LitKind , MetaItemInner , MetaItemKind , MetaItemLit , ast} ;
12
+ use rustc_ast:: { AttrStyle , LitKind , MetaItemInner , MetaItemKind , ast} ;
13
13
use rustc_attr_data_structures:: { AttributeKind , InlineAttr , ReprAttr , find_attr} ;
14
14
use rustc_data_structures:: fx:: FxHashMap ;
15
15
use rustc_errors:: { Applicability , DiagCtxtHandle , IntoDiagArg , MultiSpan , StashKey } ;
@@ -183,6 +183,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
183
183
Attribute :: Parsed ( AttributeKind :: TrackCaller ( attr_span) ) => {
184
184
self . check_track_caller ( hir_id, * attr_span, attrs, span, target)
185
185
}
186
+ Attribute :: Parsed (
187
+ AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
188
+ | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
189
+ ) => self . check_rustc_layout_scalar_valid_range ( * attr_span, span, target) ,
186
190
Attribute :: Parsed (
187
191
AttributeKind :: BodyStability { .. }
188
192
| AttributeKind :: ConstStabilityIndirect
@@ -228,10 +232,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
228
232
& mut doc_aliases,
229
233
) ,
230
234
[ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
231
- [ sym:: rustc_layout_scalar_valid_range_start, ..]
232
- | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
233
- self . check_rustc_layout_scalar_valid_range ( attr, span, target)
234
- }
235
235
[ sym:: debugger_visualizer, ..] => self . check_debugger_visualizer ( attr, target) ,
236
236
[ sym:: rustc_std_internal_symbol, ..] => {
237
237
self . check_rustc_std_internal_symbol ( attr, span, target)
@@ -1675,24 +1675,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1675
1675
}
1676
1676
}
1677
1677
1678
- fn check_rustc_layout_scalar_valid_range ( & self , attr : & Attribute , span : Span , target : Target ) {
1678
+ fn check_rustc_layout_scalar_valid_range ( & self , attr_span : Span , span : Span , target : Target ) {
1679
1679
if target != Target :: Struct {
1680
- self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct {
1681
- attr_span : attr. span ( ) ,
1682
- span,
1683
- } ) ;
1680
+ self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct { attr_span, span } ) ;
1684
1681
return ;
1685
1682
}
1686
-
1687
- let Some ( list) = attr. meta_item_list ( ) else {
1688
- return ;
1689
- } ;
1690
-
1691
- if !matches ! ( & list[ ..] , & [ MetaItemInner :: Lit ( MetaItemLit { kind: LitKind :: Int ( ..) , .. } ) ] ) {
1692
- self . tcx
1693
- . dcx ( )
1694
- . emit_err ( errors:: RustcLayoutScalarValidRangeArg { attr_span : attr. span ( ) } ) ;
1695
- }
1696
1683
}
1697
1684
1698
1685
/// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
0 commit comments