about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-10-25 10:19:35 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-10-26 10:49:20 -0700
commit4b43e07af90558d7d3c0eafd08776909d542b7d7 (patch)
treef26a75dc85797c1d5c1bdf18c97cbda9a2a2feeb /src/rustllvm/RustWrapper.cpp
parent9a855668fcc918071ecd1573abdeaccc6a99cbbb (diff)
downloadrust-4b43e07af90558d7d3c0eafd08776909d542b7d7.tar.gz
rust-4b43e07af90558d7d3c0eafd08776909d542b7d7.zip
std: Slightly more robust env var handling
As discovered in #29298, `env::set_var("", "")` will panic, but it turns out
that it *also* deadlocks on Unix systems. This happens because if a panic
happens while holding the environment lock, we then go try to read
RUST_BACKTRACE, grabbing the environment lock, causing a deadlock.

Specifically, the changes made here are:

* The environment lock is pushed into `std::sys` instead of `std::env`. This
  also only puts it in the Unix implementation, not Windows where the functions
  are already threadsafe.
* The `std::sys` implementation now returns `io::Result` so panics are
  explicitly at the `std::env` level. The panic messages have also been improved
  in these situations.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions