-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add a RUSTC_TIME env var to time rust crates during bootstrap #58508
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,21 @@ fn main() { | |
env::join_paths(&dylib_path).unwrap()); | ||
let mut maybe_crate = None; | ||
|
||
// Get the name of the crate we're compiling, if any. | ||
let maybe_crate_name = args.windows(2) | ||
.find(|a| &*a[0] == "--crate-name") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add an assert for checking whether the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather not add more noise to this file. |
||
.map(|crate_name| &*crate_name[1]); | ||
|
||
if let Some(current_crate) = maybe_crate_name { | ||
if let Some(target) = env::var_os("RUSTC_TIME") { | ||
if target == "all" || | ||
target.into_string().unwrap().split(",").any(|c| c.trim() == current_crate) | ||
{ | ||
cmd.arg("-Ztime"); | ||
} | ||
} | ||
} | ||
|
||
// Non-zero stages must all be treated uniformly to avoid problems when attempting to uplift | ||
// compiler libraries and such from stage 1 to 2. | ||
if stage == "0" { | ||
|
@@ -152,10 +167,7 @@ fn main() { | |
cmd.arg(format!("-Clinker={}", target_linker)); | ||
} | ||
|
||
let crate_name = args.windows(2) | ||
.find(|a| &*a[0] == "--crate-name") | ||
.unwrap(); | ||
let crate_name = &*crate_name[1]; | ||
let crate_name = maybe_crate_name.unwrap(); | ||
maybe_crate = Some(crate_name); | ||
|
||
// If we're compiling specifically the `panic_abort` crate then we pass | ||
|
Uh oh!
There was an error while loading. Please reload this page.