Rename std::panic::PanicInfo to PanicHookInfo. · model-checking/verify-rust-std@c6749ae (original) (raw)

`@@ -10,15 +10,21 @@ use crate::sync::atomic::{AtomicU8, Ordering};

`

10

10

`use crate::sync::{Condvar, Mutex, RwLock};

`

11

11

`use crate::thread::Result;

`

12

12

``

``

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

`+

)]

`

13

19

`/// A struct providing information about a panic.

`

14

20

`///

`

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.

`

20

26

`///

`

21

``

`-

/// This is the second one.

`

``

27

`` +

/// PanicHookInfo structure is passed to a panic hook set by the [set_hook] function.

``

22

28

`///

`

23

29

`/// # Examples

`

24

30

`///

`

`@@ -32,26 +38,25 @@ use crate::thread::Result;

`

32

38

`/// panic!("critical system failure");

`

33

39

```` /// ```

````

34

40

`///

`

35

``

`` -

/// [core::panic::PanicInfo]: ../../core/panic/struct.PanicInfo.html

``

36

41

`` /// [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")]

`

38

43

`#[derive(Debug)]

`

39

``

`-

pub struct PanicInfo<'a> {

`

``

44

`+

pub struct PanicHookInfo<'a> {

`

40

45

`payload: &'a (dyn Any + Send),

`

41

46

`location: &'a Location<'a>,

`

42

47

`can_unwind: bool,

`

43

48

`force_no_backtrace: bool,

`

44

49

`}

`

45

50

``

46

``

`-

impl<'a> PanicInfo<'a> {

`

``

51

`+

impl<'a> PanicHookInfo<'a> {

`

47

52

`#[inline]

`

48

53

`pub(crate) fn new(

`

49

54

`location: &'a Location<'a>,

`

50

55

`payload: &'a (dyn Any + Send),

`

51

56

`can_unwind: bool,

`

52

57

`force_no_backtrace: bool,

`

53

58

`) -> Self {

`

54

``

`-

PanicInfo { payload, location, can_unwind, force_no_backtrace }

`

``

59

`+

PanicHookInfo { payload, location, can_unwind, force_no_backtrace }

`

55

60

`}

`

56

61

``

57

62

`/// Returns the payload associated with the panic.

`

`@@ -145,7 +150,7 @@ impl<'a> PanicInfo<'a> {

`

145

150

`}

`

146

151

``

147

152

`#[stable(feature = "panic_hook_display", since = "1.26.0")]

`

148

``

`-

impl fmt::Display for PanicInfo<'_> {

`

``

153

`+

impl fmt::Display for PanicHookInfo<'_> {

`

149

154

`fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {

`

150

155

` formatter.write_str("panicked at ")?;

`

151

156

`self.location.fmt(formatter)?;

`

`@@ -204,7 +209,7 @@ pub use core::panic::{AssertUnwindSafe, RefUnwindSafe, UnwindSafe};

`

204

209

`` /// The message can be of any (Any + Send) type, not just strings.

``

205

210

`///

`

206

211

`` /// 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].

``

208

213

`///

`

209

214

`` /// See the [panic!] macro for more information about panicking.

``

210

215

`#[stable(feature = "panic_any", since = "1.51.0")]

`