@@ -687,26 +687,10 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
687687 intrinsics:: abort ( )
688688 }
689689
690- let loc = Location :: caller ( ) ;
691- return crate :: sys_common:: backtrace:: __rust_end_short_backtrace ( move || {
692- rust_panic_with_hook (
693- & mut Payload :: new ( msg) ,
694- loc,
695- /* can_unwind */ true ,
696- /* force_no_backtrace */ false ,
697- )
698- } ) ;
699-
700690 struct Payload < A > {
701691 inner : Option < A > ,
702692 }
703693
704- impl < A : Send + ' static > Payload < A > {
705- fn new ( inner : A ) -> Payload < A > {
706- Payload { inner : Some ( inner) }
707- }
708- }
709-
710694 unsafe impl < A : Send + ' static > PanicPayload for Payload < A > {
711695 fn take_box ( & mut self ) -> * mut ( dyn Any + Send ) {
712696 // Note that this should be the only allocation performed in this code path. Currently
@@ -729,14 +713,24 @@ pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
729713 }
730714 }
731715
732- impl < A : Send + ' static > fmt:: Display for Payload < A > {
716+ impl < A : ' static > fmt:: Display for Payload < A > {
733717 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
734718 match & self . inner {
735719 Some ( a) => f. write_str ( payload_as_str ( a) ) ,
736720 None => process:: abort ( ) ,
737721 }
738722 }
739723 }
724+
725+ let loc = Location :: caller ( ) ;
726+ crate :: sys_common:: backtrace:: __rust_end_short_backtrace ( move || {
727+ rust_panic_with_hook (
728+ & mut Payload { inner : Some ( msg) } ,
729+ loc,
730+ /* can_unwind */ true ,
731+ /* force_no_backtrace */ false ,
732+ )
733+ } )
740734}
741735
742736fn payload_as_str ( payload : & dyn Any ) -> & str {
0 commit comments