@@ -150,16 +150,18 @@ pub enum RustBacktrace {
150
150
RuntimeDisabled ,
151
151
}
152
152
153
+ // If the `backtrace` feature of this crate isn't enabled quickly return
154
+ // `Disabled` so this can be constant propagated all over the place to
155
+ // optimize away callers.
156
+ #[ cfg( not( feature = "backtrace" ) ) ]
157
+ pub fn rust_backtrace_env ( ) -> RustBacktrace {
158
+ RustBacktrace :: Disabled
159
+ }
160
+
153
161
// For now logging is turned off by default, and this function checks to see
154
162
// whether the magical environment variable is present to see if it's turned on.
163
+ #[ cfg( feature = "backtrace" ) ]
155
164
pub fn rust_backtrace_env ( ) -> RustBacktrace {
156
- // If the `backtrace` feature of this crate isn't enabled quickly return
157
- // `None` so this can be constant propagated all over the place to turn
158
- // optimize away callers.
159
- if !cfg ! ( feature = "backtrace" ) {
160
- return RustBacktrace :: Disabled ;
161
- }
162
-
163
165
// Setting environment variables for Fuchsia components isn't a standard
164
166
// or easily supported workflow. For now, always display backtraces.
165
167
if cfg ! ( target_os = "fuchsia" ) {
@@ -189,6 +191,15 @@ pub fn rust_backtrace_env() -> RustBacktrace {
189
191
format
190
192
}
191
193
194
+ /// Setting for printing the full backtrace, unless backtraces are completely disabled
195
+ pub ( crate ) fn rust_backtrace_print_full ( ) -> RustBacktrace {
196
+ if cfg ! ( feature = "backtrace" ) {
197
+ RustBacktrace :: Print ( PrintFmt :: Full )
198
+ } else {
199
+ RustBacktrace :: Disabled
200
+ }
201
+ }
202
+
192
203
/// Prints the filename of the backtrace frame.
193
204
///
194
205
/// See also `output`.
0 commit comments