File tree 2 files changed +7
-6
lines changed
2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 6
6
//! interface for panicking is:
7
7
//!
8
8
//! ```
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<'_>) -> !
11
10
//! # { loop {} }
12
11
//! ```
13
12
//!
@@ -35,7 +34,7 @@ use crate::panic::{Location, PanicInfo};
35
34
// never inline unless panic_immediate_abort to avoid code
36
35
// bloat at the call sites as much as possible
37
36
#[ 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
39
38
pub fn panic ( expr : & str , location : & Location < ' _ > ) -> ! {
40
39
if cfg ! ( feature = "panic_immediate_abort" ) {
41
40
unsafe { super :: intrinsics:: abort ( ) }
@@ -52,7 +51,7 @@ pub fn panic(expr: &str, location: &Location<'_>) -> ! {
52
51
53
52
#[ cold]
54
53
#[ 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
56
55
fn panic_bounds_check ( location : & Location < ' _ > , index : usize , len : usize ) -> ! {
57
56
if cfg ! ( feature = "panic_immediate_abort" ) {
58
57
unsafe { super :: intrinsics:: abort ( ) }
Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ extern {
44
44
data : * mut u8 ,
45
45
data_ptr : * mut usize ,
46
46
vtable_ptr : * mut usize ) -> u32 ;
47
+
48
+ /// `payload` is actually a `*mut &mut dyn BoxMeUp` but that would cause FFI warnings.
47
49
#[ unwind( allowed) ]
48
50
fn __rust_start_panic ( payload : usize ) -> u32 ;
49
51
}
@@ -294,7 +296,7 @@ pub fn panicking() -> bool {
294
296
update_panic_count ( 0 ) != 0
295
297
}
296
298
297
- /// Entry point of panic from the libcore crate.
299
+ /// Entry point of panic from the libcore crate (`panic_impl` lang item) .
298
300
#[ cfg( not( test) ) ]
299
301
#[ panic_handler]
300
302
#[ unwind( allowed) ]
@@ -380,7 +382,7 @@ fn continue_panic_fmt(info: &PanicInfo<'_>) -> ! {
380
382
#[ unstable( feature = "libstd_sys_internals" ,
381
383
reason = "used by the panic! macro" ,
382
384
issue = "0" ) ]
383
- #[ cfg_attr( not( test) , lang = "begin_panic" ) ]
385
+ #[ cfg_attr( not( test) , lang = "begin_panic" ) ] // lang item for CTFE panic support
384
386
// never inline unless panic_immediate_abort to avoid code
385
387
// bloat at the call sites as much as possible
386
388
#[ cfg_attr( not( feature="panic_immediate_abort" ) , inline( never) ) ]
You can’t perform that action at this time.
0 commit comments