Skip to content

Commit dac0a15

Browse files
committed
rename the crate, not the feature
1 parent b609547 commit dac0a15

File tree

9 files changed

+24
-22
lines changed

9 files changed

+24
-22
lines changed

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ impl Build {
490490
features.push_str(" llvm-libunwind");
491491
}
492492
if self.config.backtrace {
493-
features.push_str(" backtrace_support");
493+
features.push_str(" backtrace");
494494
}
495495
if self.config.profiler {
496496
features.push_str(" profiler");

src/libstd/Cargo.toml

+7-6
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ profiler_builtins = { path = "../libprofiler_builtins", optional = true }
2525
unwind = { path = "../libunwind" }
2626
hashbrown = { version = "0.5.0", features = ['rustc-dep-of-std'] }
2727

28-
[dependencies.backtrace]
28+
[dependencies.backtrace_rs]
29+
package = "backtrace"
2930
version = "0.3.37"
3031
default-features = false # without the libstd `backtrace` feature, stub out everything
3132
features = [ "rustc-dep-of-std" ] # enable build support for integrating into libstd
@@ -58,11 +59,11 @@ cc = "1.0"
5859
[features]
5960
default = ["std_detect_file_io", "std_detect_dlsym_getauxval"]
6061

61-
backtrace_support = [
62-
"backtrace/dbghelp", # backtrace/symbolize on MSVC
63-
"backtrace/libbacktrace", # symbolize on most platforms
64-
"backtrace/libunwind", # backtrace on most platforms
65-
"backtrace/dladdr", # symbolize on platforms w/o libbacktrace
62+
backtrace = [
63+
"backtrace_rs/dbghelp", # backtrace/symbolize on MSVC
64+
"backtrace_rs/libbacktrace", # symbolize on most platforms
65+
"backtrace_rs/libunwind", # backtrace on most platforms
66+
"backtrace_rs/dladdr", # symbolize on platforms w/o libbacktrace
6667
]
6768

6869
panic-unwind = ["panic_unwind"]

src/libstd/backtrace.rs

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst};
9797
use crate::sync::Mutex;
9898
use crate::sys_common::backtrace::{output_filename, lock};
9999
use crate::vec::Vec;
100+
use backtrace_rs as backtrace;
100101
use backtrace::BytesOrWideString;
101102

102103
/// A captured OS thread stack backtrace.

src/libstd/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
println!("cargo:rustc-link-lib=zircon");
5050
println!("cargo:rustc-link-lib=fdio");
5151
} else if target.contains("cloudabi") {
52-
if cfg!(feature = "backtrace_support") {
52+
if cfg!(feature = "backtrace") {
5353
println!("cargo:rustc-link-lib=unwind");
5454
}
5555
println!("cargo:rustc-link-lib=c");

src/libstd/panicking.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,17 @@ pub fn take_hook() -> Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send> {
157157
}
158158

159159
fn default_hook(info: &PanicInfo<'_>) {
160-
#[cfg(feature = "backtrace_support")]
160+
#[cfg(feature = "backtrace")]
161161
use crate::sys_common::{backtrace as backtrace_mod};
162162

163163
// If this is a double panic, make sure that we print a backtrace
164164
// for this panic. Otherwise only print it if logging is enabled.
165-
#[cfg(feature = "backtrace_support")]
165+
#[cfg(feature = "backtrace")]
166166
let log_backtrace = {
167167
let panics = update_panic_count(0);
168168

169169
if panics >= 2 {
170-
Some(backtrace::PrintFmt::Full)
170+
Some(backtrace_rs::PrintFmt::Full)
171171
} else {
172172
backtrace_mod::log_enabled()
173173
}
@@ -190,7 +190,7 @@ fn default_hook(info: &PanicInfo<'_>) {
190190
let _ = writeln!(err, "thread '{}' panicked at '{}', {}",
191191
name, msg, location);
192192

193-
#[cfg(feature = "backtrace_support")]
193+
#[cfg(feature = "backtrace")]
194194
{
195195
use crate::sync::atomic::{AtomicBool, Ordering};
196196

src/libstd/rt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindS
4444
sys::args::init(argc, argv);
4545

4646
// Let's run some code!
47-
#[cfg(feature = "backtrace_support")]
47+
#[cfg(feature = "backtrace")]
4848
let exit_code = panic::catch_unwind(|| {
4949
sys_common::backtrace::__rust_begin_short_backtrace(move || main())
5050
});
51-
#[cfg(not(feature = "backtrace_support"))]
51+
#[cfg(not(feature = "backtrace"))]
5252
let exit_code = panic::catch_unwind(move || main());
5353

5454
sys_common::cleanup();

src/libstd/sys_common/backtrace.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::io::prelude::*;
99
use crate::path::{self, Path, PathBuf};
1010
use crate::sys::mutex::Mutex;
1111

12-
use backtrace::{BacktraceFmt, BytesOrWideString, PrintFmt};
12+
use backtrace_rs::{BacktraceFmt, BytesOrWideString, PrintFmt};
1313

1414
/// Max number of frames to print.
1515
const MAX_NB_FRAMES: usize = 100;
@@ -33,7 +33,7 @@ pub fn lock() -> impl Drop {
3333
}
3434

3535
/// Prints the current backtrace.
36-
#[cfg(feature = "backtrace_support")]
36+
#[cfg(feature = "backtrace")]
3737
pub fn print(w: &mut dyn Write, format: PrintFmt) -> io::Result<()> {
3838
// There are issues currently linking libbacktrace into tests, and in
3939
// general during libstd's own unit tests we're not testing this path. In
@@ -74,14 +74,14 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
7474
bt_fmt.add_context()?;
7575
let mut idx = 0;
7676
let mut res = Ok(());
77-
backtrace::trace_unsynchronized(|frame| {
77+
backtrace_rs::trace_unsynchronized(|frame| {
7878
if print_fmt == PrintFmt::Short && idx > MAX_NB_FRAMES {
7979
return false;
8080
}
8181

8282
let mut hit = false;
8383
let mut stop = false;
84-
backtrace::resolve_frame_unsynchronized(frame, |symbol| {
84+
backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| {
8585
hit = true;
8686
if print_fmt == PrintFmt::Short {
8787
if let Some(sym) = symbol.name().and_then(|s| s.as_str()) {
@@ -129,7 +129,7 @@ where
129129

130130
// For now logging is turned off by default, and this function checks to see
131131
// whether the magical environment variable is present to see if it's turned on.
132-
#[cfg(feature = "backtrace_support")]
132+
#[cfg(feature = "backtrace")]
133133
pub fn log_enabled() -> Option<PrintFmt> {
134134
use crate::sync::atomic::{self, Ordering};
135135

src/libstd/thread/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,11 @@ impl Builder {
465465
}
466466

467467
thread_info::set(imp::guard::current(), their_thread);
468-
#[cfg(feature = "backtrace_support")]
468+
#[cfg(feature = "backtrace")]
469469
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
470470
crate::sys_common::backtrace::__rust_begin_short_backtrace(f)
471471
}));
472-
#[cfg(not(feature = "backtrace_support"))]
472+
#[cfg(not(feature = "backtrace"))]
473473
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f));
474474
*their_packet.get() = Some(try_result);
475475
};

src/libtest/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ proc_macro = { path = "../libproc_macro" }
2323

2424
# Forward features to the `std` crate as necessary
2525
[features]
26-
backtrace_support = ["std/backtrace_support"]
26+
backtrace = ["std/backtrace"]
2727
compiler-builtins-c = ["std/compiler-builtins-c"]
2828
llvm-libunwind = ["std/llvm-libunwind"]
2929
panic-unwind = ["std/panic_unwind"]

0 commit comments

Comments
 (0)