mirror of https://github.com/rust-lang/rust.git
Apply suggestions from code review
This commit is contained in:
parent
53a870c506
commit
21396828e4
|
@ -58,7 +58,7 @@
|
||||||
//! `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` at runtime might not actually change
|
//! `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` at runtime might not actually change
|
||||||
//! how backtraces are captured.
|
//! how backtraces are captured.
|
||||||
|
|
||||||
#![stable(feature = "backtrace", since = "1.64.0")]
|
#![stable(feature = "backtrace", since = "1.65.0")]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
@ -104,7 +104,7 @@ use crate::vec::Vec;
|
||||||
/// previous point in time. In some instances the `Backtrace` type may
|
/// previous point in time. In some instances the `Backtrace` type may
|
||||||
/// internally be empty due to configuration. For more information see
|
/// internally be empty due to configuration. For more information see
|
||||||
/// `Backtrace::capture`.
|
/// `Backtrace::capture`.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub struct Backtrace {
|
pub struct Backtrace {
|
||||||
inner: Inner,
|
inner: Inner,
|
||||||
|
@ -112,7 +112,7 @@ pub struct Backtrace {
|
||||||
|
|
||||||
/// The current status of a backtrace, indicating whether it was captured or
|
/// The current status of a backtrace, indicating whether it was captured or
|
||||||
/// whether it is empty for some other reason.
|
/// whether it is empty for some other reason.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum BacktraceStatus {
|
pub enum BacktraceStatus {
|
||||||
|
@ -170,7 +170,7 @@ enum BytesOrWide {
|
||||||
Wide(Vec<u16>),
|
Wide(Vec<u16>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
impl fmt::Debug for Backtrace {
|
impl fmt::Debug for Backtrace {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let capture = match &self.inner {
|
let capture = match &self.inner {
|
||||||
|
@ -286,7 +286,7 @@ impl Backtrace {
|
||||||
///
|
///
|
||||||
/// To forcibly capture a backtrace regardless of environment variables, use
|
/// To forcibly capture a backtrace regardless of environment variables, use
|
||||||
/// the `Backtrace::force_capture` function.
|
/// the `Backtrace::force_capture` function.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[inline(never)] // want to make sure there's a frame here to remove
|
#[inline(never)] // want to make sure there's a frame here to remove
|
||||||
pub fn capture() -> Backtrace {
|
pub fn capture() -> Backtrace {
|
||||||
if !Backtrace::enabled() {
|
if !Backtrace::enabled() {
|
||||||
|
@ -305,7 +305,7 @@ impl Backtrace {
|
||||||
/// Note that capturing a backtrace can be an expensive operation on some
|
/// Note that capturing a backtrace can be an expensive operation on some
|
||||||
/// platforms, so this should be used with caution in performance-sensitive
|
/// platforms, so this should be used with caution in performance-sensitive
|
||||||
/// parts of code.
|
/// parts of code.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[inline(never)] // want to make sure there's a frame here to remove
|
#[inline(never)] // want to make sure there's a frame here to remove
|
||||||
pub fn force_capture() -> Backtrace {
|
pub fn force_capture() -> Backtrace {
|
||||||
Backtrace::create(Backtrace::force_capture as usize)
|
Backtrace::create(Backtrace::force_capture as usize)
|
||||||
|
@ -313,8 +313,8 @@ impl Backtrace {
|
||||||
|
|
||||||
/// Forcibly captures a disabled backtrace, regardless of environment
|
/// Forcibly captures a disabled backtrace, regardless of environment
|
||||||
/// variable configuration.
|
/// variable configuration.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[rustc_const_stable(feature = "backtrace", since = "1.64.0")]
|
#[rustc_const_stable(feature = "backtrace", since = "1.65.0")]
|
||||||
pub const fn disabled() -> Backtrace {
|
pub const fn disabled() -> Backtrace {
|
||||||
Backtrace { inner: Inner::Disabled }
|
Backtrace { inner: Inner::Disabled }
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ impl Backtrace {
|
||||||
/// Returns the status of this backtrace, indicating whether this backtrace
|
/// Returns the status of this backtrace, indicating whether this backtrace
|
||||||
/// request was unsupported, disabled, or a stack trace was actually
|
/// request was unsupported, disabled, or a stack trace was actually
|
||||||
/// captured.
|
/// captured.
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn status(&self) -> BacktraceStatus {
|
pub fn status(&self) -> BacktraceStatus {
|
||||||
match self.inner {
|
match self.inner {
|
||||||
|
@ -378,7 +378,7 @@ impl<'a> Backtrace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "backtrace", since = "1.64.0")]
|
#[stable(feature = "backtrace", since = "1.65.0")]
|
||||||
impl fmt::Display for Backtrace {
|
impl fmt::Display for Backtrace {
|
||||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let capture = match &self.inner {
|
let capture = match &self.inner {
|
||||||
|
|
Loading…
Reference in New Issue