@@ -372,7 +372,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
372
372
TerminatorKind :: Return => {
373
373
crate :: abi:: codegen_return ( fx) ;
374
374
}
375
- TerminatorKind :: Assert { cond, expected, msg, target, unwind : _ } => {
375
+ TerminatorKind :: Assert { cond, expected, msg, target, unwind } => {
376
376
if !fx. tcx . sess . overflow_checks ( ) && msg. is_optional_overflow_check ( ) {
377
377
let target = fx. get_block ( * target) ;
378
378
fx. bcx . ins ( ) . jump ( target, & [ ] ) ;
@@ -402,6 +402,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
402
402
fx,
403
403
rustc_hir:: LangItem :: PanicBoundsCheck ,
404
404
& [ index, len, location] ,
405
+ * unwind,
405
406
Some ( source_info. span ) ,
406
407
) ;
407
408
}
@@ -414,6 +415,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
414
415
fx,
415
416
rustc_hir:: LangItem :: PanicMisalignedPointerDereference ,
416
417
& [ required, found, location] ,
418
+ * unwind,
417
419
Some ( source_info. span ) ,
418
420
) ;
419
421
}
@@ -424,6 +426,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
424
426
fx,
425
427
rustc_hir:: LangItem :: PanicNullPointerDereference ,
426
428
& [ location] ,
429
+ * unwind,
427
430
Some ( source_info. span ) ,
428
431
)
429
432
}
@@ -434,6 +437,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
434
437
fx,
435
438
msg. panic_function ( ) ,
436
439
& [ location] ,
440
+ * unwind,
437
441
Some ( source_info. span ) ,
438
442
) ;
439
443
}
@@ -492,7 +496,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
492
496
destination,
493
497
target,
494
498
fn_span,
495
- unwind : _ ,
499
+ unwind,
496
500
call_source : _,
497
501
} => {
498
502
fx. tcx . prof . generic_activity ( "codegen call" ) . run ( || {
@@ -503,6 +507,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
503
507
args,
504
508
* destination,
505
509
* target,
510
+ * unwind,
506
511
)
507
512
} ) ;
508
513
}
@@ -565,9 +570,9 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
565
570
| TerminatorKind :: CoroutineDrop => {
566
571
bug ! ( "shouldn't exist at codegen {:?}" , bb_data. terminator( ) ) ;
567
572
}
568
- TerminatorKind :: Drop { place, target, unwind : _ , replace : _ } => {
573
+ TerminatorKind :: Drop { place, target, unwind, replace : _ } => {
569
574
let drop_place = codegen_place ( fx, * place) ;
570
- crate :: abi:: codegen_drop ( fx, source_info, drop_place, * target) ;
575
+ crate :: abi:: codegen_drop ( fx, source_info, drop_place, * target, * unwind ) ;
571
576
}
572
577
} ;
573
578
}
@@ -1089,7 +1094,13 @@ pub(crate) fn codegen_panic_nounwind<'tcx>(
1089
1094
let msg_len = fx. bcx . ins ( ) . iconst ( fx. pointer_type , i64:: try_from ( msg_str. len ( ) ) . unwrap ( ) ) ;
1090
1095
let args = [ msg_ptr, msg_len] ;
1091
1096
1092
- codegen_panic_inner ( fx, rustc_hir:: LangItem :: PanicNounwind , & args, span) ;
1097
+ codegen_panic_inner (
1098
+ fx,
1099
+ rustc_hir:: LangItem :: PanicNounwind ,
1100
+ & args,
1101
+ UnwindAction :: Terminate ( UnwindTerminateReason :: Abi ) ,
1102
+ span,
1103
+ ) ;
1093
1104
}
1094
1105
1095
1106
pub ( crate ) fn codegen_unwind_terminate < ' tcx > (
@@ -1099,13 +1110,20 @@ pub(crate) fn codegen_unwind_terminate<'tcx>(
1099
1110
) {
1100
1111
let args = [ ] ;
1101
1112
1102
- codegen_panic_inner ( fx, reason. lang_item ( ) , & args, Some ( source_info. span ) ) ;
1113
+ codegen_panic_inner (
1114
+ fx,
1115
+ reason. lang_item ( ) ,
1116
+ & args,
1117
+ UnwindAction :: Terminate ( UnwindTerminateReason :: Abi ) ,
1118
+ Some ( source_info. span ) ,
1119
+ ) ;
1103
1120
}
1104
1121
1105
1122
fn codegen_panic_inner < ' tcx > (
1106
1123
fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
1107
1124
lang_item : rustc_hir:: LangItem ,
1108
1125
args : & [ Value ] ,
1126
+ _unwind : UnwindAction ,
1109
1127
span : Option < Span > ,
1110
1128
) {
1111
1129
fx. bcx . set_cold_block ( fx. bcx . current_block ( ) . unwrap ( ) ) ;
@@ -1121,6 +1139,8 @@ fn codegen_panic_inner<'tcx>(
1121
1139
1122
1140
let symbol_name = fx. tcx . symbol_name ( instance) . name ;
1123
1141
1142
+ // FIXME implement cleanup on exceptions
1143
+
1124
1144
fx. lib_call (
1125
1145
symbol_name,
1126
1146
args. iter ( ) . map ( |& arg| AbiParam :: new ( fx. bcx . func . dfg . value_type ( arg) ) ) . collect ( ) ,
0 commit comments