1
Fork 0

Don't call env::set_var in rustc_driver::install_ice_hook

Modifying an environment variable would make the function unsafe to
call.
This commit is contained in:
Tobias Bucher 2024-05-13 09:18:23 +02:00
parent ba956ef4b0
commit b98b8d76b1

View file

@ -11,6 +11,7 @@
#![allow(internal_features)] #![allow(internal_features)]
#![feature(decl_macro)] #![feature(decl_macro)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(panic_backtrace_config)]
#![feature(panic_update_hook)] #![feature(panic_update_hook)]
#![feature(result_flattening)] #![feature(result_flattening)]
@ -1317,8 +1318,8 @@ pub fn install_ice_hook(
// by the user. Compiler developers and other rustc users can // by the user. Compiler developers and other rustc users can
// opt in to less-verbose backtraces by manually setting "RUST_BACKTRACE" // opt in to less-verbose backtraces by manually setting "RUST_BACKTRACE"
// (e.g. `RUST_BACKTRACE=1`) // (e.g. `RUST_BACKTRACE=1`)
if std::env::var_os("RUST_BACKTRACE").is_none() { if env::var_os("RUST_BACKTRACE").is_none() {
std::env::set_var("RUST_BACKTRACE", "full"); panic::set_backtrace_style(panic::BacktraceStyle::Full);
} }
let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default()); let using_internal_features = Arc::new(std::sync::atomic::AtomicBool::default());