mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 20:46:48 +00:00
rename the crate, not the feature
This commit is contained in:
parent
b60954757e
commit
dac0a158eb
@ -490,7 +490,7 @@ impl Build {
|
||||
features.push_str(" llvm-libunwind");
|
||||
}
|
||||
if self.config.backtrace {
|
||||
features.push_str(" backtrace_support");
|
||||
features.push_str(" backtrace");
|
||||
}
|
||||
if self.config.profiler {
|
||||
features.push_str(" profiler");
|
||||
|
@ -25,7 +25,8 @@ profiler_builtins = { path = "../libprofiler_builtins", optional = true }
|
||||
unwind = { path = "../libunwind" }
|
||||
hashbrown = { version = "0.5.0", features = ['rustc-dep-of-std'] }
|
||||
|
||||
[dependencies.backtrace]
|
||||
[dependencies.backtrace_rs]
|
||||
package = "backtrace"
|
||||
version = "0.3.37"
|
||||
default-features = false # without the libstd `backtrace` feature, stub out everything
|
||||
features = [ "rustc-dep-of-std" ] # enable build support for integrating into libstd
|
||||
@ -58,11 +59,11 @@ cc = "1.0"
|
||||
[features]
|
||||
default = ["std_detect_file_io", "std_detect_dlsym_getauxval"]
|
||||
|
||||
backtrace_support = [
|
||||
"backtrace/dbghelp", # backtrace/symbolize on MSVC
|
||||
"backtrace/libbacktrace", # symbolize on most platforms
|
||||
"backtrace/libunwind", # backtrace on most platforms
|
||||
"backtrace/dladdr", # symbolize on platforms w/o libbacktrace
|
||||
backtrace = [
|
||||
"backtrace_rs/dbghelp", # backtrace/symbolize on MSVC
|
||||
"backtrace_rs/libbacktrace", # symbolize on most platforms
|
||||
"backtrace_rs/libunwind", # backtrace on most platforms
|
||||
"backtrace_rs/dladdr", # symbolize on platforms w/o libbacktrace
|
||||
]
|
||||
|
||||
panic-unwind = ["panic_unwind"]
|
||||
|
@ -97,6 +97,7 @@ use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst};
|
||||
use crate::sync::Mutex;
|
||||
use crate::sys_common::backtrace::{output_filename, lock};
|
||||
use crate::vec::Vec;
|
||||
use backtrace_rs as backtrace;
|
||||
use backtrace::BytesOrWideString;
|
||||
|
||||
/// A captured OS thread stack backtrace.
|
||||
|
@ -49,7 +49,7 @@ fn main() {
|
||||
println!("cargo:rustc-link-lib=zircon");
|
||||
println!("cargo:rustc-link-lib=fdio");
|
||||
} else if target.contains("cloudabi") {
|
||||
if cfg!(feature = "backtrace_support") {
|
||||
if cfg!(feature = "backtrace") {
|
||||
println!("cargo:rustc-link-lib=unwind");
|
||||
}
|
||||
println!("cargo:rustc-link-lib=c");
|
||||
|
@ -157,17 +157,17 @@ pub fn take_hook() -> Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send> {
|
||||
}
|
||||
|
||||
fn default_hook(info: &PanicInfo<'_>) {
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
use crate::sys_common::{backtrace as backtrace_mod};
|
||||
|
||||
// If this is a double panic, make sure that we print a backtrace
|
||||
// for this panic. Otherwise only print it if logging is enabled.
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
let log_backtrace = {
|
||||
let panics = update_panic_count(0);
|
||||
|
||||
if panics >= 2 {
|
||||
Some(backtrace::PrintFmt::Full)
|
||||
Some(backtrace_rs::PrintFmt::Full)
|
||||
} else {
|
||||
backtrace_mod::log_enabled()
|
||||
}
|
||||
@ -190,7 +190,7 @@ fn default_hook(info: &PanicInfo<'_>) {
|
||||
let _ = writeln!(err, "thread '{}' panicked at '{}', {}",
|
||||
name, msg, location);
|
||||
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
{
|
||||
use crate::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
|
@ -44,11 +44,11 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindS
|
||||
sys::args::init(argc, argv);
|
||||
|
||||
// Let's run some code!
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
let exit_code = panic::catch_unwind(|| {
|
||||
sys_common::backtrace::__rust_begin_short_backtrace(move || main())
|
||||
});
|
||||
#[cfg(not(feature = "backtrace_support"))]
|
||||
#[cfg(not(feature = "backtrace"))]
|
||||
let exit_code = panic::catch_unwind(move || main());
|
||||
|
||||
sys_common::cleanup();
|
||||
|
@ -9,7 +9,7 @@ use crate::io::prelude::*;
|
||||
use crate::path::{self, Path, PathBuf};
|
||||
use crate::sys::mutex::Mutex;
|
||||
|
||||
use backtrace::{BacktraceFmt, BytesOrWideString, PrintFmt};
|
||||
use backtrace_rs::{BacktraceFmt, BytesOrWideString, PrintFmt};
|
||||
|
||||
/// Max number of frames to print.
|
||||
const MAX_NB_FRAMES: usize = 100;
|
||||
@ -33,7 +33,7 @@ pub fn lock() -> impl Drop {
|
||||
}
|
||||
|
||||
/// Prints the current backtrace.
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
pub fn print(w: &mut dyn Write, format: PrintFmt) -> io::Result<()> {
|
||||
// There are issues currently linking libbacktrace into tests, and in
|
||||
// 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::
|
||||
bt_fmt.add_context()?;
|
||||
let mut idx = 0;
|
||||
let mut res = Ok(());
|
||||
backtrace::trace_unsynchronized(|frame| {
|
||||
backtrace_rs::trace_unsynchronized(|frame| {
|
||||
if print_fmt == PrintFmt::Short && idx > MAX_NB_FRAMES {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut hit = false;
|
||||
let mut stop = false;
|
||||
backtrace::resolve_frame_unsynchronized(frame, |symbol| {
|
||||
backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| {
|
||||
hit = true;
|
||||
if print_fmt == PrintFmt::Short {
|
||||
if let Some(sym) = symbol.name().and_then(|s| s.as_str()) {
|
||||
@ -129,7 +129,7 @@ where
|
||||
|
||||
// For now logging is turned off by default, and this function checks to see
|
||||
// whether the magical environment variable is present to see if it's turned on.
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
pub fn log_enabled() -> Option<PrintFmt> {
|
||||
use crate::sync::atomic::{self, Ordering};
|
||||
|
||||
|
@ -465,11 +465,11 @@ impl Builder {
|
||||
}
|
||||
|
||||
thread_info::set(imp::guard::current(), their_thread);
|
||||
#[cfg(feature = "backtrace_support")]
|
||||
#[cfg(feature = "backtrace")]
|
||||
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
||||
crate::sys_common::backtrace::__rust_begin_short_backtrace(f)
|
||||
}));
|
||||
#[cfg(not(feature = "backtrace_support"))]
|
||||
#[cfg(not(feature = "backtrace"))]
|
||||
let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f));
|
||||
*their_packet.get() = Some(try_result);
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ proc_macro = { path = "../libproc_macro" }
|
||||
|
||||
# Forward features to the `std` crate as necessary
|
||||
[features]
|
||||
backtrace_support = ["std/backtrace_support"]
|
||||
backtrace = ["std/backtrace"]
|
||||
compiler-builtins-c = ["std/compiler-builtins-c"]
|
||||
llvm-libunwind = ["std/llvm-libunwind"]
|
||||
panic-unwind = ["std/panic_unwind"]
|
||||
|
Loading…
Reference in New Issue
Block a user