@@ -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 } ;
@@ -163,6 +163,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
163
163
Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
164
164
self . check_naked ( hir_id, * attr_span, span, target)
165
165
}
166
+ Attribute :: Parsed (
167
+ AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
168
+ | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
169
+ ) => self . check_rustc_layout_scalar_valid_range ( * attr_span, span, target) ,
166
170
Attribute :: Parsed (
167
171
AttributeKind :: BodyStability { .. }
168
172
| AttributeKind :: ConstStabilityIndirect
@@ -212,10 +216,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
212
216
) ,
213
217
[ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
214
218
[ sym:: export_name, ..] => self . check_export_name ( hir_id, attr, span, target) ,
215
- [ sym:: rustc_layout_scalar_valid_range_start, ..]
216
- | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
217
- self . check_rustc_layout_scalar_valid_range ( attr, span, target)
218
- }
219
219
[ sym:: debugger_visualizer, ..] => self . check_debugger_visualizer ( attr, target) ,
220
220
[ sym:: rustc_std_internal_symbol, ..] => {
221
221
self . check_rustc_std_internal_symbol ( attr, span, target)
@@ -1660,24 +1660,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1660
1660
}
1661
1661
}
1662
1662
1663
- fn check_rustc_layout_scalar_valid_range ( & self , attr : & Attribute , span : Span , target : Target ) {
1663
+ fn check_rustc_layout_scalar_valid_range ( & self , attr_span : Span , span : Span , target : Target ) {
1664
1664
if target != Target :: Struct {
1665
- self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct {
1666
- attr_span : attr. span ( ) ,
1667
- span,
1668
- } ) ;
1665
+ self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct { attr_span, span } ) ;
1669
1666
return ;
1670
1667
}
1671
-
1672
- let Some ( list) = attr. meta_item_list ( ) else {
1673
- return ;
1674
- } ;
1675
-
1676
- if !matches ! ( & list[ ..] , & [ MetaItemInner :: Lit ( MetaItemLit { kind: LitKind :: Int ( ..) , .. } ) ] ) {
1677
- self . tcx
1678
- . dcx ( )
1679
- . emit_err ( errors:: RustcLayoutScalarValidRangeArg { attr_span : attr. span ( ) } ) ;
1680
- }
1681
1668
}
1682
1669
1683
1670
/// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
0 commit comments