@@ -19,7 +19,7 @@ struct AsmArgs {
19
19
operands : Vec < ( ast:: InlineAsmOperand , Span ) > ,
20
20
named_args : FxHashMap < Symbol , usize > ,
21
21
reg_args : FxHashSet < usize > ,
22
- clobber_abi : Option < ( Symbol , Span ) > ,
22
+ clobber_abis : Vec < ( Symbol , Span ) > ,
23
23
options : ast:: InlineAsmOptions ,
24
24
options_spans : Vec < Span > ,
25
25
}
@@ -64,7 +64,7 @@ fn parse_args<'a>(
64
64
operands : vec ! [ ] ,
65
65
named_args : FxHashMap :: default ( ) ,
66
66
reg_args : FxHashSet :: default ( ) ,
67
- clobber_abi : None ,
67
+ clobber_abis : Vec :: new ( ) ,
68
68
options : ast:: InlineAsmOptions :: empty ( ) ,
69
69
options_spans : vec ! [ ] ,
70
70
} ;
@@ -210,7 +210,7 @@ fn parse_args<'a>(
210
210
. span_labels ( args. options_spans . clone ( ) , "previous options" )
211
211
. span_label ( span, "argument" )
212
212
. emit ( ) ;
213
- } else if let Some ( ( _, abi_span) ) = args. clobber_abi {
213
+ } else if let Some ( & ( _, abi_span) ) = args. clobber_abis . last ( ) {
214
214
ecx. struct_span_err ( span, "arguments are not allowed after clobber_abi" )
215
215
. span_label ( abi_span, "clobber_abi" )
216
216
. span_label ( span, "argument" )
@@ -322,7 +322,7 @@ fn parse_args<'a>(
322
322
// Bail out now since this is likely to confuse MIR
323
323
return Err ( err) ;
324
324
}
325
- if let Some ( ( _, abi_span) ) = args. clobber_abi {
325
+ if let Some ( & ( _, abi_span) ) = args. clobber_abis . last ( ) {
326
326
if is_global_asm {
327
327
let err =
328
328
ecx. struct_span_err ( abi_span, "`clobber_abi` cannot be used with `global_asm!`" ) ;
@@ -453,14 +453,7 @@ fn parse_clobber_abi<'a>(
453
453
454
454
let new_span = span_start. to ( p. prev_token . span ) ;
455
455
456
- if let Some ( ( _, prev_span) ) = args. clobber_abi {
457
- let mut err = p
458
- . sess
459
- . span_diagnostic
460
- . struct_span_err ( new_span, "clobber_abi specified multiple times" ) ;
461
- err. span_label ( prev_span, "clobber_abi previously specified here" ) ;
462
- return Err ( err) ;
463
- } else if !args. options_spans . is_empty ( ) {
456
+ if !args. options_spans . is_empty ( ) {
464
457
let mut err = p
465
458
. sess
466
459
. span_diagnostic
@@ -469,7 +462,7 @@ fn parse_clobber_abi<'a>(
469
462
return Err ( err) ;
470
463
}
471
464
472
- args. clobber_abi = Some ( ( clobber_abi, new_span) ) ;
465
+ args. clobber_abis . push ( ( clobber_abi, new_span) ) ;
473
466
474
467
Ok ( ( ) )
475
468
}
@@ -770,7 +763,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
770
763
template,
771
764
template_strs : template_strs. into_boxed_slice ( ) ,
772
765
operands : args. operands ,
773
- clobber_abi : args. clobber_abi ,
766
+ clobber_abis : args. clobber_abis ,
774
767
options : args. options ,
775
768
line_spans,
776
769
} )
0 commit comments