@@ -3,6 +3,7 @@ use lint::BuiltinLintDiag;
33use rustc_ast:: ptr:: P ;
44use rustc_ast:: token:: { self , Delimiter } ;
55use rustc_ast:: tokenstream:: TokenStream ;
6+ use rustc_ast:: AsmMacro ;
67use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
78use rustc_errors:: PResult ;
89use rustc_expand:: base:: * ;
@@ -484,6 +485,7 @@ fn parse_reg<'a>(
484485
485486fn expand_preparsed_asm (
486487 ecx : & mut ExtCtxt < ' _ > ,
488+ asm_macro : ast:: AsmMacro ,
487489 args : AsmArgs ,
488490) -> ExpandResult < Result < ast:: InlineAsm , ErrorGuaranteed > , ( ) > {
489491 let mut template = vec ! [ ] ;
@@ -774,6 +776,7 @@ fn expand_preparsed_asm(
774776 }
775777
776778 ExpandResult :: Ready ( Ok ( ast:: InlineAsm {
779+ asm_macro,
777780 template,
778781 template_strs : template_strs. into_boxed_slice ( ) ,
779782 operands : args. operands ,
@@ -790,7 +793,7 @@ pub(super) fn expand_asm<'cx>(
790793) -> MacroExpanderResult < ' cx > {
791794 ExpandResult :: Ready ( match parse_args ( ecx, sp, tts, false ) {
792795 Ok ( args) => {
793- let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, args) else {
796+ let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, AsmMacro :: Asm , args) else {
794797 return ExpandResult :: Retry ( ( ) ) ;
795798 } ;
796799 let expr = match mac {
@@ -819,7 +822,8 @@ pub(super) fn expand_naked_asm<'cx>(
819822) -> MacroExpanderResult < ' cx > {
820823 ExpandResult :: Ready ( match parse_args ( ecx, sp, tts, false ) {
821824 Ok ( args) => {
822- let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, args) else {
825+ let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, AsmMacro :: NakedAsm , args)
826+ else {
823827 return ExpandResult :: Retry ( ( ) ) ;
824828 } ;
825829 let expr = match mac {
@@ -857,7 +861,8 @@ pub(super) fn expand_global_asm<'cx>(
857861) -> MacroExpanderResult < ' cx > {
858862 ExpandResult :: Ready ( match parse_args ( ecx, sp, tts, true ) {
859863 Ok ( args) => {
860- let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, args) else {
864+ let ExpandResult :: Ready ( mac) = expand_preparsed_asm ( ecx, AsmMacro :: GlobalAsm , args)
865+ else {
861866 return ExpandResult :: Retry ( ( ) ) ;
862867 } ;
863868 match mac {
0 commit comments