Skip to content

Commit

Permalink
Rollup merge of #125063 - tbu-:pr_set_ice_hook_env, r=michaelwoerister
Browse files Browse the repository at this point in the history
Don't call `env::set_var` in `rustc_driver::install_ice_hook`

Modifying an environment variable would make the function unsafe to call.
  • Loading branch information
fmease authored May 13, 2024
2 parents 3ea4fdf + b98b8d7 commit 8e1dc65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![allow(internal_features)]
#![feature(decl_macro)]
#![feature(let_chains)]
#![feature(panic_backtrace_config)]
#![feature(panic_update_hook)]
#![feature(result_flattening)]

Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 8e1dc65

Please sign in to comment.