diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2024-05-13 09:18:23 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2024-05-13 09:37:29 +0200 |
| commit | b98b8d76b1228999dd97058ea4e4a4719fe2f287 (patch) | |
| tree | 6c6e80a7e41aa42d4265e52586279dd9e20bf56e | |
| parent | ba956ef4b00c91579cff9b2220358ee3a46d982f (diff) | |
| download | rust-b98b8d76b1228999dd97058ea4e4a4719fe2f287.tar.gz rust-b98b8d76b1228999dd97058ea4e4a4719fe2f287.zip | |
Don't call `env::set_var` in `rustc_driver::install_ice_hook`
Modifying an environment variable would make the function unsafe to call.
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index b2d38a00f0b..ba6b9ef0784 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -11,6 +11,7 @@ #![allow(internal_features)] #![feature(decl_macro)] #![feature(let_chains)] +#![feature(panic_backtrace_config)] #![feature(panic_update_hook)] #![feature(result_flattening)] @@ -1317,8 +1318,8 @@ pub fn install_ice_hook( // by the user. Compiler developers and other rustc users can // opt in to less-verbose backtraces by manually setting "RUST_BACKTRACE" // (e.g. `RUST_BACKTRACE=1`) - if std::env::var_os("RUST_BACKTRACE").is_none() { - std::env::set_var("RUST_BACKTRACE", "full"); + if env::var_os("RUST_BACKTRACE").is_none() { + panic::set_backtrace_style(panic::BacktraceStyle::Full); } let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default()); |
