-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//! hi | ||
#![unstable(feature = "core_backtrace", issue = "74465")] | ||
use crate::fmt; | ||
|
||
// perma(?)-unstable | ||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
/// | ||
pub trait RawBacktraceImpl: fmt::Debug + fmt::Display + 'static { | ||
/// | ||
unsafe fn drop_and_free(self: *mut Self); | ||
} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
/// | ||
pub struct Backtrace { | ||
inner: *mut dyn RawBacktraceImpl, | ||
} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
unsafe impl Send for Backtrace {} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
unsafe impl Sync for Backtrace {} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
impl Drop for Backtrace { | ||
fn drop(&mut self) { | ||
unsafe { RawBacktraceImpl::drop_and_free(self.inner) } | ||
} | ||
} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
impl fmt::Debug for Backtrace { | ||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
let imp: &dyn RawBacktraceImpl = unsafe { &*self.inner }; | ||
fmt::Debug::fmt(imp, fmt) | ||
} | ||
} | ||
|
||
#[unstable(feature = "core_backtrace", issue = "74465")] | ||
impl fmt::Display for Backtrace { | ||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
let imp: &dyn RawBacktraceImpl = unsafe { &*self.inner }; | ||
fmt::Display::fmt(imp, fmt) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters