@@ -2352,6 +2352,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
23522352 }
23532353 }
23542354
2355+ // TODO: empty
23552356 fn check_instruction_set ( & self , attr : & Attribute , _item : Option < ItemLike < ' _ > > ) {
23562357 if let AttrKind :: Normal ( ref p) = attr. kind {
23572358 let inner_tokens = p. item . args . inner_tokens ( ) ;
@@ -2360,7 +2361,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
23602361 // Valid item for `instruction_set()` is:
23612362 // - arm::a32
23622363 // - arm::t32
2363- let valid_attribute = match ( tokens. next ( ) , tokens. next ( ) , tokens. next ( ) ) {
2364+ match ( tokens. next ( ) , tokens. next ( ) , tokens. next ( ) ) {
23642365 (
23652366 Some ( TokenTree :: Token ( first_token, _) ) ,
23662367 Some ( TokenTree :: Token ( second_token, _) ) ,
@@ -2369,18 +2370,23 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
23692370 ( Some ( first_ident) , TokenKind :: PathSep , Some ( third_ident) )
23702371 if first_ident. 0 . name == sym:: arm =>
23712372 {
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 } ) ;
23732381 }
2374- _ => false ,
23752382 } ,
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+ }
23772389 } ;
2378-
2379- if !valid_attribute {
2380- self . dcx ( ) . emit_err ( errors:: InvalidInstructionSet { span : attr. span } ) ;
2381- } else {
2382- return ;
2383- }
23842390 }
23852391 }
23862392}
0 commit comments