about summary refs log tree commit diff
path: root/src/bootstrap/bin/rustc.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-02 07:38:36 +0000
committerbors <bors@rust-lang.org>2019-05-02 07:38:36 +0000
commit758dc9af504e2fe75813bd362619231ecc727898 (patch)
treebba5214e3fd0edcb1e6503afcfcba8f5d93dc5f2 /src/bootstrap/bin/rustc.rs
parent92b5e20ad59b183a2e6cd79423f54b8aa7ac9cbf (diff)
parent16ad9777b8afd3991b4501e602a04e5e40214b56 (diff)
downloadrust-758dc9af504e2fe75813bd362619231ecc727898.tar.gz
rust-758dc9af504e2fe75813bd362619231ecc727898.zip
Auto merge of #60156 - RalfJung:macos-rand, r=oli-obk,alexcrichton
use SecRandomCopyBytes on macOS in Miri

This is a hack to fix https://github.com/rust-lang/miri/issues/686: on macOS, rustc will open `/dev/urandom` to initialize a `HashMap`. That's quite hard to emulate properly in Miri without a full-blown implementation of file descriptors.  However, Miri needs an implementation of `SecRandomCopyBytes` anyway to support [getrandom](https://crates.io/crates/getrandom), so using it here should work just as well.

This will only have an effect when libstd is compiled specifically for Miri, but that will generally be the case when people use `cargo miri`.

This is clearly a hack, so I am opening this to start a discussion about whether we are okay with such a hack or not.

Cc @oli-obk
Diffstat (limited to 'src/bootstrap/bin/rustc.rs')
-rw-r--r--src/bootstrap/bin/rustc.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 50d170b8a88..821c37dc235 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -262,6 +262,7 @@ fn main() {
             // The flags here should be kept in sync with `add_miri_default_args`
             // in miri's `src/lib.rs`.
             cmd.arg("-Zalways-encode-mir");
+            cmd.arg("--cfg=miri");
             // These options are preferred by miri, to be able to perform better validation,
             // but the bootstrap compiler might not understand them.
             if stage != "0" {