@@ -71,6 +71,7 @@ unsafe extern "Rust" {
7171/// with our panic count.
7272#[ cfg( not( test) ) ]
7373#[ rustc_std_internal_symbol]
74+ #[ allow( missing_panic_entrypoint) ]
7475extern "C" fn __rust_drop_panic ( ) -> ! {
7576 rtabort ! ( "Rust panics must be rethrown" ) ;
7677}
@@ -79,6 +80,7 @@ extern "C" fn __rust_drop_panic() -> ! {
7980/// object which does not correspond to a Rust panic.
8081#[ cfg( not( test) ) ]
8182#[ rustc_std_internal_symbol]
83+ #[ allow( missing_panic_entrypoint) ]
8284extern "C" fn __rust_foreign_exception ( ) -> ! {
8385 rtabort ! ( "Rust cannot catch foreign exceptions" ) ;
8486}
@@ -619,6 +621,7 @@ pub fn panicking() -> bool {
619621/// Entry point of panics from the core crate (`panic_impl` lang item).
620622#[ cfg( not( any( test, doctest) ) ) ]
621623#[ panic_handler]
624+ #[ allow( missing_panic_entrypoint) ]
622625pub fn panic_handler ( info : & core:: panic:: PanicInfo < ' _ > ) -> ! {
623626 struct FormatStringPayload < ' a > {
624627 inner : & ' a core:: panic:: PanicMessage < ' a > ,
@@ -711,17 +714,14 @@ pub fn panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
711714#[ unstable( feature = "libstd_sys_internals" , reason = "used by the panic! macro" , issue = "none" ) ]
712715#[ cfg_attr( not( any( test, doctest) ) , lang = "begin_panic" ) ]
713716// lang item for CTFE panic support
714- // never inline unless panic=immediate-abort to avoid code
715- // bloat at the call sites as much as possible
716- #[ cfg_attr ( not ( panic = "immediate-abort" ) , inline( never) , cold , optimize ( size ) ) ]
717- #[ cfg_attr ( panic = "immediate-abort" , inline ) ]
717+ // never inline to avoid code bloat at the call sites as much as possible
718+ # [ cold ]
719+ #[ inline( never) ]
720+ #[ optimize ( size ) ]
718721#[ track_caller]
719722#[ rustc_do_not_const_check] // hooked by const-eval
723+ #[ rustc_panic_entrypoint]
720724pub const fn begin_panic < M : Any + Send > ( msg : M ) -> ! {
721- if cfg ! ( panic = "immediate-abort" ) {
722- intrinsics:: abort ( )
723- }
724-
725725 struct Payload < A > {
726726 inner : Option < A > ,
727727 }
@@ -784,6 +784,7 @@ fn payload_as_str(payload: &dyn Any) -> &str {
784784/// panics, panic hooks, and finally dispatching to the panic runtime to either
785785/// abort or unwind.
786786#[ optimize( size) ]
787+ #[ allow( missing_panic_entrypoint) ]
787788fn panic_with_hook (
788789 payload : & mut dyn PanicPayload ,
789790 location : & Location < ' _ > ,
@@ -853,6 +854,7 @@ fn panic_with_hook(
853854/// This is the entry point for `resume_unwind`.
854855/// It just forwards the payload to the panic runtime.
855856#[ cfg_attr( panic = "immediate-abort" , inline) ]
857+ #[ allow( missing_panic_entrypoint) ]
856858pub fn resume_unwind ( payload : Box < dyn Any + Send > ) -> ! {
857859 panic_count:: increase ( false ) ;
858860
@@ -881,14 +883,8 @@ pub fn resume_unwind(payload: Box<dyn Any + Send>) -> ! {
881883/// on which to slap yer breakpoints.
882884#[ inline( never) ]
883885#[ cfg_attr( not( test) , rustc_std_internal_symbol) ]
884- #[ cfg ( not ( panic = "immediate-abort" ) ) ]
886+ #[ rustc_panic_entrypoint ]
885887fn rust_panic ( msg : & mut dyn PanicPayload ) -> ! {
886888 let code = unsafe { __rust_start_panic ( msg) } ;
887889 rtabort ! ( "failed to initiate panic, error {code}" )
888890}
889-
890- #[ cfg_attr( not( test) , rustc_std_internal_symbol) ]
891- #[ cfg( panic = "immediate-abort" ) ]
892- fn rust_panic ( _: & mut dyn PanicPayload ) -> ! {
893- crate :: intrinsics:: abort ( ) ;
894- }
0 commit comments