@@ -3,9 +3,9 @@ use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringE
33use super :: errors:: {
44 AbiSpecifiedMultipleTimes , AttSyntaxOnlyX86 , ClobberAbiNotSupported ,
55 InlineAsmUnsupportedTarget , InvalidAbiClobberAbi , InvalidAsmTemplateModifierConst ,
6- InvalidAsmTemplateModifierRegClass , InvalidAsmTemplateModifierRegClassSub ,
7- InvalidAsmTemplateModifierSym , InvalidRegister , InvalidRegisterClass , RegisterClassOnlyClobber ,
8- RegisterConflict ,
6+ InvalidAsmTemplateModifierLabel , InvalidAsmTemplateModifierRegClass ,
7+ InvalidAsmTemplateModifierRegClassSub , InvalidAsmTemplateModifierSym , InvalidRegister ,
8+ InvalidRegisterClass , RegisterClassOnlyClobber , RegisterConflict ,
99} ;
1010use super :: LoweringContext ;
1111
@@ -241,6 +241,18 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
241241 }
242242 }
243243 }
244+ InlineAsmOperand :: Label { block } => {
245+ if !self . tcx . features ( ) . asm_goto {
246+ feature_err (
247+ & sess. parse_sess ,
248+ sym:: asm_goto,
249+ * op_sp,
250+ "label operands for inline assembly are unstable" ,
251+ )
252+ . emit ( ) ;
253+ }
254+ hir:: InlineAsmOperand :: Label { block : self . lower_block ( block, false ) }
255+ }
244256 } ;
245257 ( op, self . lower_span ( * op_sp) )
246258 } )
@@ -300,6 +312,12 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
300312 op_span : op_sp,
301313 } ) ;
302314 }
315+ hir:: InlineAsmOperand :: Label { .. } => {
316+ self . dcx ( ) . emit_err ( InvalidAsmTemplateModifierLabel {
317+ placeholder_span,
318+ op_span : op_sp,
319+ } ) ;
320+ }
303321 }
304322 }
305323 }
@@ -339,7 +357,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
339357
340358 hir:: InlineAsmOperand :: Const { .. }
341359 | hir:: InlineAsmOperand :: SymFn { .. }
342- | hir:: InlineAsmOperand :: SymStatic { .. } => {
360+ | hir:: InlineAsmOperand :: SymStatic { .. }
361+ | hir:: InlineAsmOperand :: Label { .. } => {
343362 unreachable ! ( "{op:?} is not a register operand" ) ;
344363 }
345364 } ;
0 commit comments