Document difference between core and std's PanicInfo. · model-checking/verify-rust-std@ca0bfeb (original) (raw)
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,6 +4,15 @@ use crate::panic::Location; | ||
4 | 4 | /// A struct providing information about a panic. |
5 | 5 | /// |
6 | 6 | /// A `PanicInfo` structure is passed to the panic handler defined by `#[panic_handler]`. |
7 | +/// | |
8 | +/// There two `PanicInfo` types: | |
9 | +/// - `core::panic::PanicInfo`, which is used as an argument to a `#[panic_handler]` in `#![no_std]` programs. | |
10 | +/// - [`std::panic::PanicInfo`], which is used as an argument to a panic hook set by [`std::panic::set_hook`]. | |
11 | +/// | |
12 | +/// This is the first one. | |
13 | +/// | |
14 | +/// [`std::panic::set_hook`]: ../../std/panic/fn.set_hook.html | |
15 | +/// [`std::panic::PanicInfo`]: ../../std/panic/struct.PanicInfo.html | |
7 | 16 | #[lang = "panic_info"] |
8 | 17 | #[stable(feature = "panic_hooks", since = "1.10.0")] |
9 | 18 | #[derive(Debug)] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -12,11 +12,16 @@ use crate::thread::Result; | ||
12 | 12 | |
13 | 13 | /// A struct providing information about a panic. |
14 | 14 | /// |
15 | -/// `PanicInfo` structure is passed to a panic hook set by the [`set_hook`] | |
16 | -/// function. | |
15 | +/// `PanicInfo` structure is passed to a panic hook set by the [`set_hook`] function. | |
17 | 16 | /// |
18 | 17 | /// [`set_hook`]: ../../std/panic/fn.set_hook.html |
19 | 18 | /// |
19 | +/// There two `PanicInfo` types: | |
20 | +/// - [`core::panic::PanicInfo`], which is used as an argument to a `#[panic_handler]` in `#![no_std]` programs. | |
21 | +/// - `std::panic::PanicInfo`, which is used as an argument to a panic hook set by [`std::panic::set_hook`]. | |
22 | +/// | |
23 | +/// This is the second one. | |
24 | +/// | |
20 | 25 | /// # Examples |
21 | 26 | /// |
22 | 27 | /// ```should_panic |
@@ -28,6 +33,8 @@ use crate::thread::Result; | ||
28 | 33 | /// |
29 | 34 | /// panic!("critical system failure"); |
30 | 35 | /// ``` |
36 | +/// | |
37 | +/// [`core::panic::PanicInfo`]: ../../core/panic/struct.PanicInfo.html | |
31 | 38 | #[stable(feature = "panic_hooks", since = "1.10.0")] |
32 | 39 | #[derive(Debug)] |
33 | 40 | pub struct PanicInfo<'a> { |