@@ -400,6 +400,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
400400 line_spans,
401401 } ) => {
402402 use rustc_middle:: { mir, thir} ;
403+
404+ let destination_block = this. cfg . start_new_block ( ) ;
405+ let mut targets = if options. contains ( InlineAsmOptions :: NORETURN ) {
406+ vec ! [ ]
407+ } else {
408+ vec ! [ destination_block]
409+ } ;
410+
403411 let operands = operands
404412 . into_iter ( )
405413 . map ( |op| match * op {
@@ -455,17 +463,28 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
455463 thir:: InlineAsmOperand :: SymStatic { def_id } => {
456464 mir:: InlineAsmOperand :: SymStatic { def_id }
457465 }
458- thir:: InlineAsmOperand :: Label { .. } => {
459- todo ! ( )
466+ thir:: InlineAsmOperand :: Label { block } => {
467+ let target = this. cfg . start_new_block ( ) ;
468+ let target_index = targets. len ( ) ;
469+ targets. push ( target) ;
470+
471+ let tmp = this. get_unit_temp ( ) ;
472+ let target = unpack ! ( this. ast_block( tmp, target, block, source_info) ) ;
473+ this. cfg . terminate (
474+ target,
475+ source_info,
476+ TerminatorKind :: Goto { target : destination_block } ,
477+ ) ;
478+
479+ mir:: InlineAsmOperand :: Label { target_index }
460480 }
461481 } )
462482 . collect ( ) ;
463483
464- if !options . contains ( InlineAsmOptions :: NORETURN ) {
484+ if !expr . ty . is_never ( ) {
465485 this. cfg . push_assign_unit ( block, source_info, destination, this. tcx ) ;
466486 }
467487
468- let destination_block = this. cfg . start_new_block ( ) ;
469488 this. cfg . terminate (
470489 block,
471490 source_info,
@@ -474,11 +493,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
474493 operands,
475494 options,
476495 line_spans,
477- targets : if options. contains ( InlineAsmOptions :: NORETURN ) {
478- Vec :: new ( )
479- } else {
480- vec ! [ destination_block]
481- } ,
496+ targets,
482497 unwind : if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
483498 UnwindAction :: Continue
484499 } else {
0 commit comments