@@ -477,6 +477,28 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
477477 helper. do_call ( self , & mut bx, fn_abi, llfn, & args, None , cleanup) ;
478478 }
479479
480+ fn codegen_abort_terminator (
481+ & mut self ,
482+ helper : TerminatorCodegenHelper < ' tcx > ,
483+ mut bx : Bx ,
484+ terminator : & mir:: Terminator < ' tcx > ,
485+ ) {
486+ let span = terminator. source_info . span ;
487+ self . set_debug_loc ( & mut bx, terminator. source_info ) ;
488+
489+ // Get the location information.
490+ let location = self . get_caller_location ( & mut bx, terminator. source_info ) . immediate ( ) ;
491+
492+ // Obtain the panic entry point.
493+ let def_id = common:: langcall ( bx. tcx ( ) , Some ( span) , "" , LangItem :: PanicNoUnwind ) ;
494+ let instance = ty:: Instance :: mono ( bx. tcx ( ) , def_id) ;
495+ let fn_abi = bx. fn_abi_of_instance ( instance, ty:: List :: empty ( ) ) ;
496+ let llfn = bx. get_fn_addr ( instance) ;
497+
498+ // Codegen the actual panic invoke/call.
499+ helper. do_call ( self , & mut bx, fn_abi, llfn, & [ location] , None , None ) ;
500+ }
501+
480502 /// Returns `true` if this is indeed a panic intrinsic and codegen is done.
481503 fn codegen_panic_intrinsic (
482504 & mut self ,
@@ -1014,10 +1036,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10141036 mir:: TerminatorKind :: Resume => self . codegen_resume_terminator ( helper, bx) ,
10151037
10161038 mir:: TerminatorKind :: Abort => {
1017- bx. abort ( ) ;
1018- // `abort` does not terminate the block, so we still need to generate
1019- // an `unreachable` terminator after it.
1020- bx. unreachable ( ) ;
1039+ self . codegen_abort_terminator ( helper, bx, terminator) ;
10211040 }
10221041
10231042 mir:: TerminatorKind :: Goto { target } => {
0 commit comments