@@ -372,7 +372,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
372372 TerminatorKind :: Return => {
373373 crate :: abi:: codegen_return ( fx) ;
374374 }
375- TerminatorKind :: Assert { cond, expected, msg, target, unwind : _ } => {
375+ TerminatorKind :: Assert { cond, expected, msg, target, unwind } => {
376376 if !fx. tcx . sess . overflow_checks ( ) && msg. is_optional_overflow_check ( ) {
377377 let target = fx. get_block ( * target) ;
378378 fx. bcx . ins ( ) . jump ( target, & [ ] ) ;
@@ -402,6 +402,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
402402 fx,
403403 rustc_hir:: LangItem :: PanicBoundsCheck ,
404404 & [ index, len, location] ,
405+ * unwind,
405406 Some ( source_info. span ) ,
406407 ) ;
407408 }
@@ -414,6 +415,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
414415 fx,
415416 rustc_hir:: LangItem :: PanicMisalignedPointerDereference ,
416417 & [ required, found, location] ,
418+ * unwind,
417419 Some ( source_info. span ) ,
418420 ) ;
419421 }
@@ -424,6 +426,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
424426 fx,
425427 rustc_hir:: LangItem :: PanicNullPointerDereference ,
426428 & [ location] ,
429+ * unwind,
427430 Some ( source_info. span ) ,
428431 )
429432 }
@@ -434,6 +437,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
434437 fx,
435438 msg. panic_function ( ) ,
436439 & [ location] ,
440+ * unwind,
437441 Some ( source_info. span ) ,
438442 ) ;
439443 }
@@ -492,7 +496,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
492496 destination,
493497 target,
494498 fn_span,
495- unwind : _ ,
499+ unwind,
496500 call_source : _,
497501 } => {
498502 fx. tcx . prof . generic_activity ( "codegen call" ) . run ( || {
@@ -503,6 +507,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
503507 args,
504508 * destination,
505509 * target,
510+ * unwind,
506511 )
507512 } ) ;
508513 }
@@ -565,9 +570,9 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
565570 | TerminatorKind :: CoroutineDrop => {
566571 bug ! ( "shouldn't exist at codegen {:?}" , bb_data. terminator( ) ) ;
567572 }
568- TerminatorKind :: Drop { place, target, unwind : _ , replace : _ } => {
573+ TerminatorKind :: Drop { place, target, unwind, replace : _ } => {
569574 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 ) ;
571576 }
572577 } ;
573578 }
@@ -1089,7 +1094,13 @@ pub(crate) fn codegen_panic_nounwind<'tcx>(
10891094 let msg_len = fx. bcx . ins ( ) . iconst ( fx. pointer_type , i64:: try_from ( msg_str. len ( ) ) . unwrap ( ) ) ;
10901095 let args = [ msg_ptr, msg_len] ;
10911096
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+ ) ;
10931104}
10941105
10951106pub ( crate ) fn codegen_unwind_terminate < ' tcx > (
@@ -1099,13 +1110,20 @@ pub(crate) fn codegen_unwind_terminate<'tcx>(
10991110) {
11001111 let args = [ ] ;
11011112
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+ ) ;
11031120}
11041121
11051122fn codegen_panic_inner < ' tcx > (
11061123 fx : & mut FunctionCx < ' _ , ' _ , ' tcx > ,
11071124 lang_item : rustc_hir:: LangItem ,
11081125 args : & [ Value ] ,
1126+ _unwind : UnwindAction ,
11091127 span : Option < Span > ,
11101128) {
11111129 fx. bcx . set_cold_block ( fx. bcx . current_block ( ) . unwrap ( ) ) ;
@@ -1121,6 +1139,8 @@ fn codegen_panic_inner<'tcx>(
11211139
11221140 let symbol_name = fx. tcx . symbol_name ( instance) . name ;
11231141
1142+ // FIXME implement cleanup on exceptions
1143+
11241144 fx. lib_call (
11251145 symbol_name,
11261146 args. iter ( ) . map ( |& arg| AbiParam :: new ( fx. bcx . func . dfg . value_type ( arg) ) ) . collect ( ) ,
0 commit comments