@@ -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 } ;
@@ -169,6 +169,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
169
169
Attribute :: Parsed ( AttributeKind :: Naked ( attr_span) ) => {
170
170
self . check_naked ( hir_id, * attr_span, span, target)
171
171
}
172
+ Attribute :: Parsed (
173
+ AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
174
+ | AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
175
+ ) => self . check_rustc_layout_scalar_valid_range ( * attr_span, span, target) ,
172
176
Attribute :: Parsed (
173
177
AttributeKind :: BodyStability { .. }
174
178
| AttributeKind :: ConstStabilityIndirect
@@ -218,10 +222,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
218
222
) ,
219
223
[ sym:: no_link, ..] => self . check_no_link ( hir_id, attr, span, target) ,
220
224
[ sym:: export_name, ..] => self . check_export_name ( hir_id, attr, span, target) ,
221
- [ sym:: rustc_layout_scalar_valid_range_start, ..]
222
- | [ sym:: rustc_layout_scalar_valid_range_end, ..] => {
223
- self . check_rustc_layout_scalar_valid_range ( attr, span, target)
224
- }
225
225
[ sym:: debugger_visualizer, ..] => self . check_debugger_visualizer ( attr, target) ,
226
226
[ sym:: rustc_std_internal_symbol, ..] => {
227
227
self . check_rustc_std_internal_symbol ( attr, span, target)
@@ -1666,24 +1666,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
1666
1666
}
1667
1667
}
1668
1668
1669
- fn check_rustc_layout_scalar_valid_range ( & self , attr : & Attribute , span : Span , target : Target ) {
1669
+ fn check_rustc_layout_scalar_valid_range ( & self , attr_span : Span , span : Span , target : Target ) {
1670
1670
if target != Target :: Struct {
1671
- self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct {
1672
- attr_span : attr. span ( ) ,
1673
- span,
1674
- } ) ;
1671
+ self . dcx ( ) . emit_err ( errors:: RustcLayoutScalarValidRangeNotStruct { attr_span, span } ) ;
1675
1672
return ;
1676
1673
}
1677
-
1678
- let Some ( list) = attr. meta_item_list ( ) else {
1679
- return ;
1680
- } ;
1681
-
1682
- if !matches ! ( & list[ ..] , & [ MetaItemInner :: Lit ( MetaItemLit { kind: LitKind :: Int ( ..) , .. } ) ] ) {
1683
- self . tcx
1684
- . dcx ( )
1685
- . emit_err ( errors:: RustcLayoutScalarValidRangeArg { attr_span : attr. span ( ) } ) ;
1686
- }
1687
1674
}
1688
1675
1689
1676
/// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
0 commit comments