diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-04-30 10:55:24 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2018-06-03 13:46:19 +0200 |
| commit | e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e (patch) | |
| tree | e9b2eede0e5f2703640bb76f3e7f1b1c8e23fbd2 /src/libcore/panic.rs | |
| parent | 3575be60eab140e69e5a75fe5c3b4119c2a17179 (diff) | |
| download | rust-e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e.tar.gz rust-e44ad61a2d8e3bac1d2cbf2467a7202250b8a77e.zip | |
implement #[panic_implementation]
Diffstat (limited to 'src/libcore/panic.rs')
| -rw-r--r-- | src/libcore/panic.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libcore/panic.rs b/src/libcore/panic.rs index 27ec4aaac75..37ae05309af 100644 --- a/src/libcore/panic.rs +++ b/src/libcore/panic.rs @@ -35,6 +35,7 @@ use fmt; /// /// panic!("Normal panic"); /// ``` +#[cfg_attr(not(stage0), lang = "panic_info")] #[stable(feature = "panic_hooks", since = "1.10.0")] #[derive(Debug)] pub struct PanicInfo<'a> { @@ -53,7 +54,8 @@ impl<'a> PanicInfo<'a> { pub fn internal_constructor(message: Option<&'a fmt::Arguments<'a>>, location: Location<'a>) -> Self { - PanicInfo { payload: &(), location, message } + struct NoPayload; + PanicInfo { payload: &NoPayload, location, message } } #[doc(hidden)] @@ -121,7 +123,7 @@ impl<'a> PanicInfo<'a> { #[stable(feature = "panic_hooks", since = "1.10.0")] pub fn location(&self) -> Option<&Location> { // NOTE: If this is changed to sometimes return None, - // deal with that case in std::panicking::default_hook. + // deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt. Some(&self.location) } } |
