-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #115514 - onur-ozkan:bootstrap-codebase-improvements, r…
…=albertlarsan68 optimize and cleanup bootstrap source I suggest reviewing this commit by commit.
- Loading branch information
Showing
13 changed files
with
97 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// Parses the value of the "RUSTC_VERBOSE" environment variable and returns it as a `usize`. | ||
/// If it was not defined, returns 0 by default. | ||
/// | ||
/// Panics if "RUSTC_VERBOSE" is defined with the value that is not an unsigned integer. | ||
fn parse_rustc_verbose() -> usize { | ||
use std::str::FromStr; | ||
|
||
match std::env::var("RUSTC_VERBOSE") { | ||
Ok(s) => usize::from_str(&s).expect("RUSTC_VERBOSE should be an integer"), | ||
Err(_) => 0, | ||
} | ||
} | ||
|
||
/// Parses the value of the "RUSTC_STAGE" environment variable and returns it as a `String`. | ||
/// | ||
/// If "RUSTC_STAGE" was not set, the program will be terminated with 101. | ||
fn parse_rustc_stage() -> String { | ||
std::env::var("RUSTC_STAGE").unwrap_or_else(|_| { | ||
// Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead. | ||
eprintln!("rustc shim: fatal: RUSTC_STAGE was not set"); | ||
eprintln!("rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap"); | ||
exit(101); | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.