@@ -394,6 +394,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
394394 line_spans,
395395 } ) => {
396396 use rustc_middle:: { mir, thir} ;
397+
398+ let destination_block = this. cfg . start_new_block ( ) ;
399+ if !expr. ty . is_never ( ) {
400+ this. cfg . push_assign_unit (
401+ destination_block,
402+ source_info,
403+ destination,
404+ this. tcx ,
405+ ) ;
406+ }
407+
408+ let mut targets = if options. contains ( InlineAsmOptions :: NORETURN ) {
409+ vec ! [ ]
410+ } else {
411+ vec ! [ destination_block]
412+ } ;
413+
397414 let operands = operands
398415 . into_iter ( )
399416 . map ( |op| match * op {
@@ -449,17 +466,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
449466 thir:: InlineAsmOperand :: SymStatic { def_id } => {
450467 mir:: InlineAsmOperand :: SymStatic { def_id }
451468 }
452- thir:: InlineAsmOperand :: Label { .. } => {
453- todo ! ( )
469+ thir:: InlineAsmOperand :: Label { block } => {
470+ let target = this. cfg . start_new_block ( ) ;
471+ let target_index = targets. len ( ) ;
472+ targets. push ( target) ;
473+
474+ let tmp = this. get_unit_temp ( ) ;
475+ let target = unpack ! ( this. ast_block( tmp, target, block, source_info) ) ;
476+ this. cfg . terminate (
477+ target,
478+ source_info,
479+ TerminatorKind :: Goto { target : destination_block } ,
480+ ) ;
481+
482+ mir:: InlineAsmOperand :: Label { target_index }
454483 }
455484 } )
456485 . collect ( ) ;
457486
458- if !options. contains ( InlineAsmOptions :: NORETURN ) {
459- this. cfg . push_assign_unit ( block, source_info, destination, this. tcx ) ;
460- }
461-
462- let destination_block = this. cfg . start_new_block ( ) ;
463487 this. cfg . terminate (
464488 block,
465489 source_info,
@@ -468,11 +492,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
468492 operands,
469493 options,
470494 line_spans,
471- targets : if options. contains ( InlineAsmOptions :: NORETURN ) {
472- Vec :: new ( )
473- } else {
474- vec ! [ destination_block]
475- } ,
495+ targets,
476496 unwind : if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
477497 UnwindAction :: Continue
478498 } else {
0 commit comments