@@ -2,9 +2,10 @@ use rustc_ast as ast;
22use rustc_ast:: ptr:: P ;
33use rustc_ast:: token:: { self , Delimiter } ;
44use rustc_ast:: tokenstream:: TokenStream ;
5- use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap , FxIndexSet } ;
5+ use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
66use rustc_errors:: PResult ;
77use rustc_expand:: base:: { self , * } ;
8+ use rustc_index:: bit_set:: GrowableBitSet ;
89use rustc_parse:: parser:: Parser ;
910use rustc_parse_format as parse;
1011use rustc_session:: lint;
@@ -21,7 +22,7 @@ pub struct AsmArgs {
2122 pub templates : Vec < P < ast:: Expr > > ,
2223 pub operands : Vec < ( ast:: InlineAsmOperand , Span ) > ,
2324 named_args : FxIndexMap < Symbol , usize > ,
24- reg_args : FxIndexSet < usize > ,
25+ reg_args : GrowableBitSet < usize > ,
2526 pub clobber_abis : Vec < ( Symbol , Span ) > ,
2627 options : ast:: InlineAsmOptions ,
2728 pub options_spans : Vec < Span > ,
@@ -213,7 +214,7 @@ pub fn parse_asm_args<'a>(
213214 } else {
214215 if !args. named_args . is_empty ( ) || !args. reg_args . is_empty ( ) {
215216 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 ( ) ;
217218
218219 diag. emit_err ( errors:: AsmPositionalAfter { span, named, explicit } ) ;
219220 }
@@ -446,8 +447,8 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option<ast::Inl
446447 // Register operands are implicitly used since they are not allowed to be
447448 // referenced in the template string.
448449 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 ;
451452 }
452453 let named_pos: FxHashMap < usize , Symbol > =
453454 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
581582 parse:: ArgumentIs ( idx) | parse:: ArgumentImplicitlyIs ( idx) => {
582583 if idx >= args. operands . len ( )
583584 || named_pos. contains_key ( & idx)
584- || args. reg_args . contains ( & idx)
585+ || args. reg_args . contains ( idx)
585586 {
586587 let msg = format ! ( "invalid reference to argument at index {}" , idx) ;
587588 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
608609 args. operands [ idx] . 1 ,
609610 "named arguments cannot be referenced by position" ,
610611 ) ;
611- } else if args. reg_args . contains ( & idx) {
612+ } else if args. reg_args . contains ( idx) {
612613 err. span_label (
613614 args. operands [ idx] . 1 ,
614615 "explicit register argument" ,
0 commit comments