about summary refs log tree commit diff
path: root/src/libstd/sys_common/backtrace.rs
diff options
context:
space:
mode:
authorStein Somers <git@steinsomers.be>2019-01-09 15:15:18 +0100
committerStein Somers <git@steinsomers.be>2019-01-09 15:15:18 +0100
commitccba43df81d5bda37c9e4d231ad4443e6f3a7e44 (patch)
treeefe674e2d5ae721f38fa8558385e0a2f12997227 /src/libstd/sys_common/backtrace.rs
parentf9f71cc32497ee4e3cbc7d9795bcf358a9268c13 (diff)
parent664c7797f6bfddf9f5e67474c2fd8017f91d7110 (diff)
downloadrust-ccba43df81d5bda37c9e4d231ad4443e6f3a7e44.tar.gz
rust-ccba43df81d5bda37c9e4d231ad4443e6f3a7e44.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/libstd/sys_common/backtrace.rs')
-rw-r--r--src/libstd/sys_common/backtrace.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs
index e44113f76f4..57f31cb726c 100644
--- a/src/libstd/sys_common/backtrace.rs
+++ b/src/libstd/sys_common/backtrace.rs
@@ -1,13 +1,3 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 /// Common code for printing the backtrace in the same way across the different
 /// supported platforms.
 
@@ -53,6 +43,14 @@ const MAX_NB_FRAMES: usize = 100;
 pub fn print(w: &mut dyn Write, format: PrintFormat) -> io::Result<()> {
     static LOCK: Mutex = Mutex::new();
 
+    // There are issues currently linking libbacktrace into tests, and in
+    // general during libstd's own unit tests we're not testing this path. In
+    // test mode immediately return here to optimize away any references to the
+    // libbacktrace symbols
+    if cfg!(test) {
+        return Ok(())
+    }
+
     // Use a lock to prevent mixed output in multithreading context.
     // Some platforms also requires it, like `SymFromAddr` on Windows.
     unsafe {