@@ -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 } ;
@@ -178,6 +178,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
178
178
Attribute :: Parsed ( AttributeKind :: TrackCaller ( attr_span) ) => {
179
179
self . check_track_caller ( hir_id, * attr_span, attrs, span, target)
180
180
}
181
+ Attribute :: Parsed (
182
+ AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
183
+ | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
184
+ ) => self . check_rustc_layout_scalar_valid_range ( * attr_span, span, target) ,
181
185
Attribute :: Parsed (
182
186
AttributeKind :: BodyStability { .. }
183
187
| AttributeKind :: ConstStabilityIndirect
@@ -224,10 +228,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
224
228
) ,
225
229
[ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
226
230
[ sym:: export_name, ..] => self . check_export_name ( hir_id, attr, span, target) ,
227
- [ sym:: rustc_layout_scalar_valid_range_start, ..]
228
- | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
229
- self . check_rustc_layout_scalar_valid_range ( attr, span, target)
230
- }
231
231
[ sym:: debugger_visualizer, ..] => self . check_debugger_visualizer ( attr, target) ,
232
232
[ sym:: rustc_std_internal_symbol, ..] => {
233
233
self . check_rustc_std_internal_symbol ( attr, span, target)
@@ -1670,24 +1670,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1670
1670
}
1671
1671
}
1672
1672
1673
- fn check_rustc_layout_scalar_valid_range ( & self , attr : & Attribute , span : Span , target : Target ) {
1673
+ fn check_rustc_layout_scalar_valid_range ( & self , attr_span : Span , span : Span , target : Target ) {
1674
1674
if target != Target :: Struct {
1675
- self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct {
1676
- attr_span : attr. span ( ) ,
1677
- span,
1678
- } ) ;
1675
+ self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct { attr_span, span } ) ;
1679
1676
return ;
1680
1677
}
1681
-
1682
- let Some ( list) = attr. meta_item_list ( ) else {
1683
- return ;
1684
- } ;
1685
-
1686
- if !matches ! ( & list[ ..] , & [ MetaItemInner :: Lit ( MetaItemLit { kind: LitKind :: Int ( ..) , .. } ) ] ) {
1687
- self . tcx
1688
- . dcx ( )
1689
- . emit_err ( errors:: RustcLayoutScalarValidRangeArg { attr_span : attr. span ( ) } ) ;
1690
- }
1691
1678
}
1692
1679
1693
1680
/// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
0 commit comments