File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 66//! interface for panicking is:
77//!
88//! ```
9- //! # use std::fmt;
10- //! fn panic_impl(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> !
9+ //! fn panic_impl(pi: &core::panic::PanicInfo<'_>) -> !
1110//! # { loop {} }
1211//! ```
1312//!
@@ -35,7 +34,7 @@ use crate::panic::{Location, PanicInfo};
3534// never inline unless panic_immediate_abort to avoid code
3635// bloat at the call sites as much as possible
3736#[ cfg_attr( not( feature="panic_immediate_abort" ) , inline( never) ) ]
38- #[ lang = "panic" ]
37+ #[ lang = "panic" ] // needed by codegen for panic on overflow and other `Assert` MIR terminators
3938pub fn panic ( expr : & str , location : & Location < ' _ > ) -> ! {
4039 if cfg ! ( feature = "panic_immediate_abort" ) {
4140 unsafe { super :: intrinsics:: abort ( ) }
@@ -52,7 +51,7 @@ pub fn panic(expr: &str, location: &Location<'_>) -> ! {
5251
5352#[ cold]
5453#[ cfg_attr( not( feature="panic_immediate_abort" ) , inline( never) ) ]
55- #[ lang = "panic_bounds_check" ]
54+ #[ lang = "panic_bounds_check" ] // needed by codegen for panic on OOB array/slice access
5655fn panic_bounds_check ( location : & Location < ' _ > , index : usize , len : usize ) -> ! {
5756 if cfg ! ( feature = "panic_immediate_abort" ) {
5857 unsafe { super :: intrinsics:: abort ( ) }
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ extern {
4444 data : * mut u8 ,
4545 data_ptr : * mut usize ,
4646 vtable_ptr : * mut usize ) -> u32 ;
47+
48+ /// `payload` is actually a `*mut &mut dyn BoxMeUp` but that would cause FFI warnings.
4749 #[ unwind( allowed) ]
4850 fn __rust_start_panic ( payload : usize ) -> u32 ;
4951}
@@ -294,7 +296,7 @@ pub fn panicking() -> bool {
294296 update_panic_count ( 0 ) != 0
295297}
296298
297- /// Entry point of panic from the libcore crate.
299+ /// Entry point of panic from the libcore crate (`panic_impl` lang item) .
298300#[ cfg( not( test) ) ]
299301#[ panic_handler]
300302#[ unwind( allowed) ]
@@ -380,7 +382,7 @@ fn continue_panic_fmt(info: &PanicInfo<'_>) -> ! {
380382#[ unstable( feature = "libstd_sys_internals" ,
381383 reason = "used by the panic! macro" ,
382384 issue = "0" ) ]
383- #[ cfg_attr( not( test) , lang = "begin_panic" ) ]
385+ #[ cfg_attr( not( test) , lang = "begin_panic" ) ] // lang item for CTFE panic support
384386// never inline unless panic_immediate_abort to avoid code
385387// bloat at the call sites as much as possible
386388#[ cfg_attr( not( feature="panic_immediate_abort" ) , inline( never) ) ]
You can’t perform that action at this time.
0 commit comments