@@ -10,15 +10,21 @@ use crate::sync::atomic::{AtomicU8, Ordering};
1010use crate :: sync:: { Condvar , Mutex , RwLock } ;
1111use crate :: thread:: Result ;
1212
13+ #[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
14+ #[ deprecated(
15+ since = "1.77.0" ,
16+ note = "use `PanicHookInfo` instead" ,
17+ suggestion = "std::panic::PanicHookInfo"
18+ ) ]
1319/// A struct providing information about a panic.
1420///
15- /// `PanicInfo` structure is passed to a panic hook set by the [`set_hook `] function.
16- ///
17- /// There two ` PanicInfo` types:
18- /// - [`core::panic::PanicInfo`], which is used as an argument to a `#[panic_handler]` in `#![no_std]` programs.
19- /// - `std::panic::PanicInfo`, which is used as an argument to a panic hook set by [`set_hook`] .
21+ /// `PanicInfo` has been renamed to [`PanicHookInfo `] to avoid confusion with
22+ /// [`core::panic::PanicInfo`].
23+ pub type PanicInfo < ' a > = PanicHookInfo < ' a > ;
24+
25+ /// A struct providing information about a panic.
2026///
21- /// This is the second one .
27+ /// `PanicHookInfo` structure is passed to a panic hook set by the [`set_hook`] function .
2228///
2329/// # Examples
2430///
@@ -32,26 +38,25 @@ use crate::thread::Result;
3238/// panic!("critical system failure");
3339/// ```
3440///
35- /// [`core::panic::PanicInfo`]: ../../core/panic/struct.PanicInfo.html
3641/// [`set_hook`]: ../../std/panic/fn.set_hook.html
37- #[ stable( feature = "panic_hooks " , since = "1.10.0 " ) ]
42+ #[ stable( feature = "panic_hook_info " , since = "CURRENT_RUSTC_VERSION " ) ]
3843#[ derive( Debug ) ]
39- pub struct PanicInfo < ' a > {
44+ pub struct PanicHookInfo < ' a > {
4045 payload : & ' a ( dyn Any + Send ) ,
4146 location : & ' a Location < ' a > ,
4247 can_unwind : bool ,
4348 force_no_backtrace : bool ,
4449}
4550
46- impl < ' a > PanicInfo < ' a > {
51+ impl < ' a > PanicHookInfo < ' a > {
4752 #[ inline]
4853 pub ( crate ) fn new (
4954 location : & ' a Location < ' a > ,
5055 payload : & ' a ( dyn Any + Send ) ,
5156 can_unwind : bool ,
5257 force_no_backtrace : bool ,
5358 ) -> Self {
54- PanicInfo { payload, location, can_unwind, force_no_backtrace }
59+ PanicHookInfo { payload, location, can_unwind, force_no_backtrace }
5560 }
5661
5762 /// Returns the payload associated with the panic.
@@ -145,7 +150,7 @@ impl<'a> PanicInfo<'a> {
145150}
146151
147152#[ stable( feature = "panic_hook_display" , since = "1.26.0" ) ]
148- impl fmt:: Display for PanicInfo < ' _ > {
153+ impl fmt:: Display for PanicHookInfo < ' _ > {
149154 fn fmt ( & self , formatter : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
150155 formatter. write_str ( "panicked at " ) ?;
151156 self . location . fmt ( formatter) ?;
@@ -204,7 +209,7 @@ pub use core::panic::{AssertUnwindSafe, RefUnwindSafe, UnwindSafe};
204209/// The message can be of any (`Any + Send`) type, not just strings.
205210///
206211/// The message is wrapped in a `Box<'static + Any + Send>`, which can be
207- /// accessed later using [`PanicInfo ::payload`].
212+ /// accessed later using [`PanicHookInfo ::payload`].
208213///
209214/// See the [`panic!`] macro for more information about panicking.
210215#[ stable( feature = "panic_any" , since = "1.51.0" ) ]
0 commit comments