@@ -10,14 +10,13 @@ use rustc_expand::base::{self, *};
1010use rustc_parse:: parser:: Parser ;
1111use rustc_span:: symbol:: { kw, sym, Symbol } ;
1212use rustc_span:: { InnerSpan , Span } ;
13- use rustc_target:: asm:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
1413
1514struct AsmArgs {
1615 template : P < ast:: Expr > ,
1716 operands : Vec < ( ast:: InlineAsmOperand , Span ) > ,
1817 named_args : FxHashMap < Symbol , usize > ,
1918 reg_args : FxHashSet < usize > ,
20- options : InlineAsmOptions ,
19+ options : ast :: InlineAsmOptions ,
2120 options_span : Option < Span > ,
2221}
2322
@@ -57,7 +56,7 @@ fn parse_args<'a>(
5756 operands : vec ! [ ] ,
5857 named_args : FxHashMap :: default ( ) ,
5958 reg_args : FxHashSet :: default ( ) ,
60- options : InlineAsmOptions :: empty ( ) ,
59+ options : ast :: InlineAsmOptions :: empty ( ) ,
6160 options_span : None ,
6261 } ;
6362
@@ -204,22 +203,22 @@ fn parse_args<'a>(
204203 }
205204 }
206205
207- if args. options . contains ( InlineAsmOptions :: NOMEM )
208- && args. options . contains ( InlineAsmOptions :: READONLY )
206+ if args. options . contains ( ast :: InlineAsmOptions :: NOMEM )
207+ && args. options . contains ( ast :: InlineAsmOptions :: READONLY )
209208 {
210209 let span = args. options_span . unwrap ( ) ;
211210 ecx. struct_span_err ( span, "the `nomem` and `readonly` options are mutually exclusive" )
212211 . emit ( ) ;
213212 }
214- if args. options . contains ( InlineAsmOptions :: PURE )
215- && args. options . contains ( InlineAsmOptions :: NORETURN )
213+ if args. options . contains ( ast :: InlineAsmOptions :: PURE )
214+ && args. options . contains ( ast :: InlineAsmOptions :: NORETURN )
216215 {
217216 let span = args. options_span . unwrap ( ) ;
218217 ecx. struct_span_err ( span, "the `pure` and `noreturn` options are mutually exclusive" )
219218 . emit ( ) ;
220219 }
221- if args. options . contains ( InlineAsmOptions :: PURE )
222- && !args. options . intersects ( InlineAsmOptions :: NOMEM | InlineAsmOptions :: READONLY )
220+ if args. options . contains ( ast :: InlineAsmOptions :: PURE )
221+ && !args. options . intersects ( ast :: InlineAsmOptions :: NOMEM | ast :: InlineAsmOptions :: READONLY )
223222 {
224223 let span = args. options_span . unwrap ( ) ;
225224 ecx. struct_span_err (
@@ -245,14 +244,14 @@ fn parse_args<'a>(
245244 _ => { }
246245 }
247246 }
248- if args. options . contains ( InlineAsmOptions :: PURE ) && !have_real_output {
247+ if args. options . contains ( ast :: InlineAsmOptions :: PURE ) && !have_real_output {
249248 ecx. struct_span_err (
250249 args. options_span . unwrap ( ) ,
251250 "asm with `pure` option must have at least one output" ,
252251 )
253252 . emit ( ) ;
254253 }
255- if args. options . contains ( InlineAsmOptions :: NORETURN ) && !outputs_sp. is_empty ( ) {
254+ if args. options . contains ( ast :: InlineAsmOptions :: NORETURN ) && !outputs_sp. is_empty ( ) {
256255 let err = ecx
257256 . struct_span_err ( outputs_sp, "asm outputs are not allowed with the `noreturn` option" ) ;
258257
@@ -270,20 +269,20 @@ fn parse_options<'a>(p: &mut Parser<'a>, args: &mut AsmArgs) -> Result<(), Diagn
270269
271270 while !p. eat ( & token:: CloseDelim ( token:: DelimToken :: Paren ) ) {
272271 if p. eat ( & token:: Ident ( sym:: pure, false ) ) {
273- args. options |= InlineAsmOptions :: PURE ;
272+ args. options |= ast :: InlineAsmOptions :: PURE ;
274273 } else if p. eat ( & token:: Ident ( sym:: nomem, false ) ) {
275- args. options |= InlineAsmOptions :: NOMEM ;
274+ args. options |= ast :: InlineAsmOptions :: NOMEM ;
276275 } else if p. eat ( & token:: Ident ( sym:: readonly, false ) ) {
277- args. options |= InlineAsmOptions :: READONLY ;
276+ args. options |= ast :: InlineAsmOptions :: READONLY ;
278277 } else if p. eat ( & token:: Ident ( sym:: preserves_flags, false ) ) {
279- args. options |= InlineAsmOptions :: PRESERVES_FLAGS ;
278+ args. options |= ast :: InlineAsmOptions :: PRESERVES_FLAGS ;
280279 } else if p. eat ( & token:: Ident ( sym:: noreturn, false ) ) {
281- args. options |= InlineAsmOptions :: NORETURN ;
280+ args. options |= ast :: InlineAsmOptions :: NORETURN ;
282281 } else if p. eat ( & token:: Ident ( sym:: nostack, false ) ) {
283- args. options |= InlineAsmOptions :: NOSTACK ;
282+ args. options |= ast :: InlineAsmOptions :: NOSTACK ;
284283 } else {
285284 p. expect ( & token:: Ident ( sym:: att_syntax, false ) ) ?;
286- args. options |= InlineAsmOptions :: ATT_SYNTAX ;
285+ args. options |= ast :: InlineAsmOptions :: ATT_SYNTAX ;
287286 }
288287
289288 // Allow trailing commas
@@ -395,7 +394,9 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, sp: Span, args: AsmArgs) -> P<ast
395394 let mut template = vec ! [ ] ;
396395 for piece in unverified_pieces {
397396 match piece {
398- parse:: Piece :: String ( s) => template. push ( InlineAsmTemplatePiece :: String ( s. to_string ( ) ) ) ,
397+ parse:: Piece :: String ( s) => {
398+ template. push ( ast:: InlineAsmTemplatePiece :: String ( s. to_string ( ) ) )
399+ }
399400 parse:: Piece :: NextArgument ( arg) => {
400401 let span = arg_spans. next ( ) . unwrap_or ( template_sp) ;
401402
@@ -467,7 +468,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, sp: Span, args: AsmArgs) -> P<ast
467468
468469 if let Some ( operand_idx) = operand_idx {
469470 used[ operand_idx] = true ;
470- template. push ( InlineAsmTemplatePiece :: Placeholder {
471+ template. push ( ast :: InlineAsmTemplatePiece :: Placeholder {
471472 operand_idx,
472473 modifier,
473474 span,
0 commit comments