@@ -2352,6 +2352,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2352
2352
}
2353
2353
}
2354
2354
2355
+ // TODO: empty
2355
2356
fn check_instruction_set ( & self , attr : & Attribute , _item : Option < ItemLike < ' _ > > ) {
2356
2357
if let AttrKind :: Normal ( ref p) = attr. kind {
2357
2358
let inner_tokens = p. item . args . inner_tokens ( ) ;
@@ -2360,7 +2361,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2360
2361
// Valid item for `instruction_set()` is:
2361
2362
// - arm::a32
2362
2363
// - arm::t32
2363
- let valid_attribute = match ( tokens. next ( ) , tokens. next ( ) , tokens. next ( ) ) {
2364
+ match ( tokens. next ( ) , tokens. next ( ) , tokens. next ( ) ) {
2364
2365
(
2365
2366
Some ( TokenTree :: Token ( first_token, _) ) ,
2366
2367
Some ( TokenTree :: Token ( second_token, _) ) ,
@@ -2369,18 +2370,23 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
2369
2370
( Some ( first_ident) , TokenKind :: PathSep , Some ( third_ident) )
2370
2371
if first_ident. 0 . name == sym:: arm =>
2371
2372
{
2372
- third_ident. 0 . name == sym:: a32 || third_ident. 0 . name == sym:: t32
2373
+ if third_ident. 0 . name == sym:: a32 || third_ident. 0 . name == sym:: t32 {
2374
+ return ;
2375
+ } else {
2376
+ self . dcx ( ) . emit_err ( errors:: InvalidInstructionSet { span : attr. span } ) ;
2377
+ }
2378
+ }
2379
+ _ => {
2380
+ self . dcx ( ) . emit_err ( errors:: InvalidInstructionSet { span : attr. span } ) ;
2373
2381
}
2374
- _ => false ,
2375
2382
} ,
2376
- _ => false ,
2383
+ ( None , None , None ) => {
2384
+ self . dcx ( ) . emit_err ( errors:: EmptyInstructionSet { span : attr. span } ) ;
2385
+ }
2386
+ _ => {
2387
+ self . dcx ( ) . emit_err ( errors:: InvalidInstructionSet { span : attr. span } ) ;
2388
+ }
2377
2389
} ;
2378
-
2379
- if !valid_attribute {
2380
- self . dcx ( ) . emit_err ( errors:: InvalidInstructionSet { span : attr. span } ) ;
2381
- } else {
2382
- return ;
2383
- }
2384
2390
}
2385
2391
}
2386
2392
}
0 commit comments