@@ -2,9 +2,10 @@ use rustc_ast as ast;
2
2
use rustc_ast:: ptr:: P ;
3
3
use rustc_ast:: token:: { self , Delimiter } ;
4
4
use rustc_ast:: tokenstream:: TokenStream ;
5
- use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap , FxIndexSet } ;
5
+ use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
6
6
use rustc_errors:: PResult ;
7
7
use rustc_expand:: base:: { self , * } ;
8
+ use rustc_index:: bit_set:: GrowableBitSet ;
8
9
use rustc_parse:: parser:: Parser ;
9
10
use rustc_parse_format as parse;
10
11
use rustc_session:: lint;
@@ -21,7 +22,7 @@ pub struct AsmArgs {
21
22
pub templates : Vec < P < ast:: Expr > > ,
22
23
pub operands : Vec < ( ast:: InlineAsmOperand , Span ) > ,
23
24
named_args : FxIndexMap < Symbol , usize > ,
24
- reg_args : FxIndexSet < usize > ,
25
+ reg_args : GrowableBitSet < usize > ,
25
26
pub clobber_abis : Vec < ( Symbol , Span ) > ,
26
27
options : ast:: InlineAsmOptions ,
27
28
pub options_spans : Vec < Span > ,
@@ -213,7 +214,7 @@ pub fn parse_asm_args<'a>(
213
214
} else {
214
215
if !args. named_args . is_empty ( ) || !args. reg_args . is_empty ( ) {
215
216
let named = args. named_args . values ( ) . map ( |p| args. operands [ * p] . 1 ) . collect ( ) ;
216
- let explicit = args. reg_args . iter ( ) . map ( |p| args. operands [ * p] . 1 ) . collect ( ) ;
217
+ let explicit = args. reg_args . iter ( ) . map ( |p| args. operands [ p] . 1 ) . collect ( ) ;
217
218
218
219
diag. emit_err ( errors:: AsmPositionalAfter { span, named, explicit } ) ;
219
220
}
@@ -446,8 +447,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
446
447
// Register operands are implicitly used since they are not allowed to be
447
448
// referenced in the template string.
448
449
let mut used = vec ! [ false ; args. operands. len( ) ] ;
449
- for pos in & args. reg_args {
450
- used[ * pos] = true ;
450
+ for pos in args. reg_args . iter ( ) {
451
+ used[ pos] = true ;
451
452
}
452
453
let named_pos: FxHashMap < usize , Symbol > =
453
454
args. named_args . iter ( ) . map ( |( & sym, & idx) | ( idx, sym) ) . collect ( ) ;
@@ -581,7 +582,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
581
582
parse:: ArgumentIs ( idx) | parse:: ArgumentImplicitlyIs ( idx) => {
582
583
if idx >= args. operands . len ( )
583
584
|| named_pos. contains_key ( & idx)
584
- || args. reg_args . contains ( & idx)
585
+ || args. reg_args . contains ( idx)
585
586
{
586
587
let msg = format ! ( "invalid reference to argument at index {}" , idx) ;
587
588
let mut err = ecx. struct_span_err ( span, & msg) ;
@@ -608,7 +609,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
608
609
args. operands [ idx] . 1 ,
609
610
"named arguments cannot be referenced by position" ,
610
611
) ;
611
- } else if args. reg_args . contains ( & idx) {
612
+ } else if args. reg_args . contains ( idx) {
612
613
err. span_label (
613
614
args. operands [ idx] . 1 ,
614
615
"explicit register argument" ,
0 commit comments