@@ -394,6 +394,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
394
394
line_spans,
395
395
} ) => {
396
396
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
+
397
414
let operands = operands
398
415
. into_iter ( )
399
416
. map ( |op| match * op {
@@ -449,17 +466,24 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
449
466
thir:: InlineAsmOperand :: SymStatic { def_id } => {
450
467
mir:: InlineAsmOperand :: SymStatic { def_id }
451
468
}
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 }
454
483
}
455
484
} )
456
485
. collect ( ) ;
457
486
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 ( ) ;
463
487
this. cfg . terminate (
464
488
block,
465
489
source_info,
@@ -468,11 +492,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
468
492
operands,
469
493
options,
470
494
line_spans,
471
- targets : if options. contains ( InlineAsmOptions :: NORETURN ) {
472
- Vec :: new ( )
473
- } else {
474
- vec ! [ destination_block]
475
- } ,
495
+ targets,
476
496
unwind : if options. contains ( InlineAsmOptions :: MAY_UNWIND ) {
477
497
UnwindAction :: Continue
478
498
} else {
0 commit comments