@@ -394,6 +394,14 @@ 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+ let mut targets = if options. contains ( InlineAsmOptions :: NORETURN ) {
400+ vec ! [ ]
401+ } else {
402+ vec ! [ destination_block]
403+ } ;
404+
397405 let operands = operands
398406 . into_iter ( )
399407 . map ( |op| match * op {
@@ -449,17 +457,28 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
449457 thir:: InlineAsmOperand :: SymStatic { def_id } => {
450458 mir:: InlineAsmOperand :: SymStatic { def_id }
451459 }
452- thir:: InlineAsmOperand :: Label { .. } => {
453- todo ! ( )
460+ thir:: InlineAsmOperand :: Label { block } => {
461+ let target = this. cfg . start_new_block ( ) ;
462+ let target_index = targets. len ( ) ;
463+ targets. push ( target) ;
464+
465+ let tmp = this. get_unit_temp ( ) ;
466+ let target = unpack ! ( this. ast_block( tmp, target, block, source_info) ) ;
467+ this. cfg . terminate (
468+ target,
469+ source_info,
470+ TerminatorKind :: Goto { target : destination_block } ,
471+ ) ;
472+
473+ mir:: InlineAsmOperand :: Label { target_index }
454474 }
455475 } )
456476 . collect ( ) ;
457477
458- if !options . contains ( InlineAsmOptions :: NORETURN ) {
478+ if !expr . ty . is_never ( ) {
459479 this. cfg . push_assign_unit ( block, source_info, destination, this. tcx ) ;
460480 }
461481
462- let destination_block = this. cfg . start_new_block ( ) ;
463482 this. cfg . terminate (
464483 block,
465484 source_info,
@@ -468,11 +487,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
468487 operands,
469488 options,
470489 line_spans,
471- targets : if options. contains ( InlineAsmOptions :: NORETURN ) {
472- Vec :: new ( )
473- } else {
474- vec ! [ destination_block]
475- } ,
490+ targets,
476491 unwind : if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
477492 UnwindAction :: Continue
478493 } else {
0 commit comments