9
9
//! implementing `std::error::Error`) to get a causal chain of where an error
10
10
//! was generated.
11
11
//!
12
- //! > **Note**: this module is unstable and is designed in [RFC 2504], and you
13
- //! > can learn more about its status in the [tracking issue].
14
- //!
15
- //! [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
16
- //! [tracking issue]: https://github.com/rust-lang/rust/issues/53487
17
- //!
18
12
//! ## Accuracy
19
13
//!
20
14
//! Backtraces are attempted to be as accurate as possible, but no guarantees
64
58
//! `RUST_LIB_BACKTRACE` or `RUST_BACKTRACE` at runtime might not actually change
65
59
//! how backtraces are captured.
66
60
67
- #![ unstable ( feature = "backtrace" , issue = "53487 " ) ]
61
+ #![ stable ( feature = "backtrace" , since = "1.64.0 " ) ]
68
62
69
63
#[ cfg( test) ]
70
64
mod tests;
@@ -110,13 +104,15 @@ use crate::vec::Vec;
110
104
/// previous point in time. In some instances the `Backtrace` type may
111
105
/// internally be empty due to configuration. For more information see
112
106
/// `Backtrace::capture`.
107
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
113
108
#[ must_use]
114
109
pub struct Backtrace {
115
110
inner : Inner ,
116
111
}
117
112
118
113
/// The current status of a backtrace, indicating whether it was captured or
119
114
/// whether it is empty for some other reason.
115
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
120
116
#[ non_exhaustive]
121
117
#[ derive( Debug , PartialEq , Eq ) ]
122
118
pub enum BacktraceStatus {
@@ -174,6 +170,7 @@ enum BytesOrWide {
174
170
Wide ( Vec < u16 > ) ,
175
171
}
176
172
173
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
177
174
impl fmt:: Debug for Backtrace {
178
175
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
179
176
let capture = match & self . inner {
@@ -200,6 +197,7 @@ impl fmt::Debug for Backtrace {
200
197
}
201
198
}
202
199
200
+ #[ unstable( feature = "backtrace_frames" , issue = "79676" ) ]
203
201
impl fmt:: Debug for BacktraceFrame {
204
202
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
205
203
let mut dbg = fmt. debug_list ( ) ;
@@ -288,6 +286,7 @@ impl Backtrace {
288
286
///
289
287
/// To forcibly capture a backtrace regardless of environment variables, use
290
288
/// the `Backtrace::force_capture` function.
289
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
291
290
#[ inline( never) ] // want to make sure there's a frame here to remove
292
291
pub fn capture ( ) -> Backtrace {
293
292
if !Backtrace :: enabled ( ) {
@@ -306,13 +305,16 @@ impl Backtrace {
306
305
/// Note that capturing a backtrace can be an expensive operation on some
307
306
/// platforms, so this should be used with caution in performance-sensitive
308
307
/// parts of code.
308
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
309
309
#[ inline( never) ] // want to make sure there's a frame here to remove
310
310
pub fn force_capture ( ) -> Backtrace {
311
311
Backtrace :: create ( Backtrace :: force_capture as usize )
312
312
}
313
313
314
314
/// Forcibly captures a disabled backtrace, regardless of environment
315
315
/// variable configuration.
316
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
317
+ #[ rustc_const_stable( feature = "backtrace" , since = "1.64.0" ) ]
316
318
pub const fn disabled ( ) -> Backtrace {
317
319
Backtrace { inner : Inner :: Disabled }
318
320
}
@@ -356,6 +358,7 @@ impl Backtrace {
356
358
/// Returns the status of this backtrace, indicating whether this backtrace
357
359
/// request was unsupported, disabled, or a stack trace was actually
358
360
/// captured.
361
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
359
362
#[ must_use]
360
363
pub fn status ( & self ) -> BacktraceStatus {
361
364
match self . inner {
@@ -375,6 +378,7 @@ impl<'a> Backtrace {
375
378
}
376
379
}
377
380
381
+ #[ stable( feature = "backtrace" , since = "1.64.0" ) ]
378
382
impl fmt:: Display for Backtrace {
379
383
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
380
384
let capture = match & self . inner {
0 commit comments