Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate MIR for the nightlies' standard library #38350

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down