Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize the backtrace feature. #72981

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Bump up version to 1.51.
  • Loading branch information
JDuchniewicz committed Jan 9, 2021
commit 2d661ef07501dc322eabe65784f1169cb948cbed
22 changes: 11 additions & 11 deletions library/std/src/backtrace.rs
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@
//! `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` at runtime may not actually change
//! how backtraces are captured.

#![stable(feature = "backtrace", since = "1.50.0")]
#![stable(feature = "backtrace", since = "1.51.0")]

#[cfg(test)]
mod tests;
@@ -103,7 +103,7 @@ use crate::vec::Vec;
/// previous point in time. In some instances the `Backtrace` type may
/// internally be empty due to configuration. For more information see
/// `Backtrace::capture`.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
pub struct Backtrace {
inner: Inner,
}
@@ -112,19 +112,19 @@ pub struct Backtrace {
/// whether it is empty for some other reason.
#[non_exhaustive]
#[derive(Debug, PartialEq, Eq)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[derive(Debug, PartialEq, Eq)]
#[derive(Clone, Debug, PartialEq, Eq)]

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems pretty reasonable to me 👍 I can't imagine this enum acquiring any fields, let alone any non-Clone ones

#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
pub enum BacktraceStatus {
/// Capturing a backtrace is not supported, likely because it's not
/// implemented for the current platform.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
Unsupported,
/// Capturing a backtrace has been disabled through either the
/// `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` environment variables.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
Disabled,
/// A backtrace has been captured and the `Backtrace` should print
/// reasonable information when rendered.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
Captured,
}

@@ -168,7 +168,7 @@ enum BytesOrWide {
Wide(Vec<u16>),
}

#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
impl fmt::Debug for Backtrace {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut capture = match &self.inner {
@@ -276,7 +276,7 @@ impl Backtrace {
///
/// To forcibly capture a backtrace regardless of environment variables, use
/// the `Backtrace::force_capture` function.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
#[inline(never)] // want to make sure there's a frame here to remove
pub fn capture() -> Backtrace {
if !Backtrace::enabled() {
@@ -295,7 +295,7 @@ impl Backtrace {
/// Note that capturing a backtrace can be an expensive operation on some
/// platforms, so this should be used with caution in performance-sensitive
/// parts of code.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
#[inline(never)] // want to make sure there's a frame here to remove
pub fn force_capture() -> Backtrace {
Backtrace::create(Backtrace::force_capture as usize)
@@ -346,7 +346,7 @@ impl Backtrace {
/// Returns the status of this backtrace, indicating whether this backtrace
/// request was unsupported, disabled, or a stack trace was actually
/// captured.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
pub fn status(&self) -> BacktraceStatus {
match self.inner {
Inner::Unsupported => BacktraceStatus::Unsupported,
@@ -356,7 +356,7 @@ impl Backtrace {
}
}

#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
impl fmt::Display for Backtrace {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut capture = match &self.inner {
2 changes: 1 addition & 1 deletion library/std/src/error.rs
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ pub trait Error: Debug + Display {
/// Note that not all errors contain a `Backtrace`. Also note that a
/// `Backtrace` may actually be empty. For more information consult the
/// `Backtrace` type itself.
#[stable(feature = "backtrace", since = "1.50.0")]
#[stable(feature = "backtrace", since = "1.51.0")]
fn backtrace(&self) -> Option<&Backtrace> {
None
}