about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-23 00:42:07 -0700
committerGitHub <noreply@github.com>2020-07-23 00:42:07 -0700
commitf98c77c8b6593cc2da36ddb33df488ed3380f2c6 (patch)
tree2af3d479b95f559951e54ac2addcb88011a1fc01 /src/libstd
parent9be109910713660e666f83ebdc6a6e717391e647 (diff)
parent50347b84dd0c08ff23bd010dc567a7c27944d029 (diff)
downloadrust-f98c77c8b6593cc2da36ddb33df488ed3380f2c6.tar.gz
rust-f98c77c8b6593cc2da36ddb33df488ed3380f2c6.zip
Rollup merge of #74490 - yaahc:disabled-bt, r=dtolnay
add a Backtrace::disabled function

Based upon @dtolnay's suggestion here: https://github.com/dtolnay/anyhow/pull/97#issuecomment-647172942
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/backtrace.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstd/backtrace.rs b/src/libstd/backtrace.rs
index e65775c1ced..09f83ea5fca 100644
--- a/src/libstd/backtrace.rs
+++ b/src/libstd/backtrace.rs
@@ -291,6 +291,12 @@ impl Backtrace {
         Backtrace::create(Backtrace::force_capture as usize)
     }
 
+    /// Forcibly captures a disabled backtrace, regardless of environment
+    /// variable configuration.
+    pub const fn disabled() -> Backtrace {
+        Backtrace { inner: Inner::Disabled }
+    }
+
     // Capture a backtrace which start just before the function addressed by
     // `ip`
     fn create(ip: usize) -> Backtrace {