@@ -150,16 +150,18 @@ pub enum RustBacktrace {
150150 RuntimeDisabled ,
151151}
152152
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+
153161// For now logging is turned off by default, and this function checks to see
154162// whether the magical environment variable is present to see if it's turned on.
163+ #[ cfg( feature = "backtrace" ) ]
155164pub 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-
163165 // Setting environment variables for Fuchsia components isn't a standard
164166 // or easily supported workflow. For now, always display backtraces.
165167 if cfg ! ( target_os = "fuchsia" ) {
@@ -189,6 +191,15 @@ pub fn rust_backtrace_env() -> RustBacktrace {
189191 format
190192}
191193
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+
192203/// Prints the filename of the backtrace frame.
193204///
194205/// See also `output`.
0 commit comments