@@ -4,7 +4,7 @@ use rustc_ast::ptr::P;
4
4
use rustc_ast:: tokenstream:: TokenStream ;
5
5
use rustc_ast:: { AsmMacro , token} ;
6
6
use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
7
- use rustc_errors:: { DiagCtxtHandle , PResult } ;
7
+ use rustc_errors:: PResult ;
8
8
use rustc_expand:: base:: * ;
9
9
use rustc_index:: bit_set:: GrowableBitSet ;
10
10
use rustc_parse:: exp;
@@ -33,7 +33,7 @@ pub enum RawAsmArgKind {
33
33
}
34
34
35
35
/// Validated assembly arguments, ready for macro expansion.
36
- pub struct AsmArgs {
36
+ struct AsmArgs {
37
37
pub templates : Vec < P < ast:: Expr > > ,
38
38
pub operands : Vec < ( ast:: InlineAsmOperand , Span ) > ,
39
39
named_args : FxIndexMap < Symbol , usize > ,
@@ -144,6 +144,7 @@ fn parse_asm_operand<'a>(
144
144
} ) )
145
145
}
146
146
147
+ // Public for rustfmt
147
148
pub fn parse_raw_asm_args < ' a > (
148
149
p : & mut Parser < ' a > ,
149
150
sp : Span ,
@@ -258,26 +259,17 @@ fn parse_args<'a>(
258
259
tts : TokenStream ,
259
260
asm_macro : AsmMacro ,
260
261
) -> PResult < ' a , AsmArgs > {
261
- let mut p = ecx. new_parser_from_tts ( tts) ;
262
- parse_asm_args ( & mut p , sp , asm_macro )
262
+ let raw_args = parse_raw_asm_args ( & mut ecx. new_parser_from_tts ( tts) , sp , asm_macro ) ? ;
263
+ validate_raw_asm_args ( ecx , asm_macro , raw_args )
263
264
}
264
265
265
- // public for use in rustfmt
266
- // FIXME: use `RawAsmArg` in the formatting code instead.
267
- pub fn parse_asm_args < ' a > (
268
- p : & mut Parser < ' a > ,
269
- sp : Span ,
270
- asm_macro : AsmMacro ,
271
- ) -> PResult < ' a , AsmArgs > {
272
- let raw_args = parse_raw_asm_args ( p, sp, asm_macro) ?;
273
- validate_raw_asm_args ( p. dcx ( ) , asm_macro, raw_args)
274
- }
275
-
276
- pub fn validate_raw_asm_args < ' a > (
277
- dcx : DiagCtxtHandle < ' a > ,
266
+ fn validate_raw_asm_args < ' a > (
267
+ ecx : & ExtCtxt < ' a > ,
278
268
asm_macro : AsmMacro ,
279
269
raw_args : Vec < RawAsmArg > ,
280
270
) -> PResult < ' a , AsmArgs > {
271
+ let dcx = ecx. dcx ( ) ;
272
+
281
273
let mut args = AsmArgs {
282
274
templates : vec ! [ ] ,
283
275
operands : vec ! [ ] ,
0 commit comments