diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index 2f674a311fef4..400973780ed2e 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -168,6 +168,19 @@ fn main() { cmd.arg("-C").arg(format!("link-args={}", rpath)); } } + + let channel = env::var("RUSTC_CHANNEL").unwrap_or(String::new()); + + // Generate MIR for all functions in the Rust libraries + // Since users will never build the stdlib themselves, they can't + // obtain an stdlib with full MIR. Thus we simply emit MIR always + // for the stdlib + // Don't do this for stage0 yet, since always_encode_mir isn't part of it yet + // Only do this for the nightly and dev channels, we don't want to increase + // the size of stable libraries, and noone is able to use MIR on stable anyway + if channel != "stable" && channel != "beta" && stage != "0" { + cmd.arg("-Zalways-encode-mir"); + } } // Actually run the compiler! diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index cd80c4298dc41..a19a0a7978ad2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -491,6 +491,7 @@ impl Build { .env("RUSTC_RPATH", self.config.rust_rpath.to_string()) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) .env("RUSTDOC_REAL", self.rustdoc(compiler)) + .env("RUSTC_CHANNEL", &self.config.channel) .env("RUSTC_FLAGS", self.rustc_flags(target).join(" ")); // Enable usage of unstable features