mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-02 00:07:42 +03:00
Add keep-stage-std to x.py
This keeps only the `std` artifacts compiled by the given stage, not the compiler. This is useful when working on the latter stages of the compiler in tandem with the standard library, since you don't have to rebuild the *entire* compiler when the standard library changes.
This commit is contained in:
@@ -59,7 +59,9 @@ fn run(self, builder: &Builder<'_>) {
|
||||
let target = self.target;
|
||||
let compiler = self.compiler;
|
||||
|
||||
if builder.config.keep_stage.contains(&compiler.stage) {
|
||||
if builder.config.keep_stage.contains(&compiler.stage)
|
||||
|| builder.config.keep_stage_std.contains(&compiler.stage)
|
||||
{
|
||||
builder.info("Warning: Using a potentially old libstd. This may not behave well.");
|
||||
builder.ensure(StdLink { compiler, target_compiler: compiler, target });
|
||||
return;
|
||||
@@ -472,6 +474,11 @@ fn run(self, builder: &Builder<'_>) {
|
||||
|
||||
if builder.config.keep_stage.contains(&compiler.stage) {
|
||||
builder.info("Warning: Using a potentially old librustc. This may not behave well.");
|
||||
builder.info("Warning: Use `--keep-stage-std` if you want to rebuild the compiler when it changes");
|
||||
builder.info(
|
||||
"Warning: Please file a GitHub issue if `--keep-stage-std` doesn't work for you.",
|
||||
);
|
||||
builder.info("Warning: It may replace `--keep-stage` in the future");
|
||||
builder.ensure(RustcLink { compiler, target_compiler: compiler, target });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ pub struct Config {
|
||||
pub on_fail: Option<String>,
|
||||
pub stage: u32,
|
||||
pub keep_stage: Vec<u32>,
|
||||
pub keep_stage_std: Vec<u32>,
|
||||
pub src: PathBuf,
|
||||
pub jobs: Option<u32>,
|
||||
pub cmd: Subcommand,
|
||||
@@ -539,6 +540,7 @@ pub fn parse(args: &[String]) -> Config {
|
||||
config.incremental = flags.incremental;
|
||||
config.dry_run = flags.dry_run;
|
||||
config.keep_stage = flags.keep_stage;
|
||||
config.keep_stage_std = flags.keep_stage_std;
|
||||
config.bindir = "bin".into(); // default
|
||||
if let Some(value) = flags.deny_warnings {
|
||||
config.deny_warnings = value;
|
||||
|
||||
+16
-1
@@ -19,6 +19,7 @@ pub struct Flags {
|
||||
pub on_fail: Option<String>,
|
||||
pub stage: Option<u32>,
|
||||
pub keep_stage: Vec<u32>,
|
||||
pub keep_stage_std: Vec<u32>,
|
||||
|
||||
pub host: Option<Vec<TargetSelection>>,
|
||||
pub target: Option<Vec<TargetSelection>>,
|
||||
@@ -144,6 +145,13 @@ pub fn parse(args: &[String]) -> Flags {
|
||||
(pass multiple times to keep e.g., both stages 0 and 1)",
|
||||
"N",
|
||||
);
|
||||
opts.optmulti(
|
||||
"",
|
||||
"keep-stage-std",
|
||||
"stage(s) of the standard library to keep without recompiling \
|
||||
(pass multiple times to keep e.g., both stages 0 and 1)",
|
||||
"N",
|
||||
);
|
||||
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
|
||||
let j_msg = format!(
|
||||
"number of jobs to run in parallel; \
|
||||
@@ -510,7 +518,9 @@ pub fn parse(args: &[String]) -> Flags {
|
||||
println!("--stage not supported for x.py check, always treated as stage 0");
|
||||
process::exit(1);
|
||||
}
|
||||
if matches.opt_str("keep-stage").is_some() {
|
||||
if matches.opt_str("keep-stage").is_some()
|
||||
|| matches.opt_str("keep-stage-std").is_some()
|
||||
{
|
||||
println!("--keep-stage not supported for x.py check, only one stage available");
|
||||
process::exit(1);
|
||||
}
|
||||
@@ -528,6 +538,11 @@ pub fn parse(args: &[String]) -> Flags {
|
||||
.into_iter()
|
||||
.map(|j| j.parse().expect("`keep-stage` should be a number"))
|
||||
.collect(),
|
||||
keep_stage_std: matches
|
||||
.opt_strs("keep-stage-std")
|
||||
.into_iter()
|
||||
.map(|j| j.parse().expect("`keep-stage-std` should be a number"))
|
||||
.collect(),
|
||||
host: if matches.opt_present("host") {
|
||||
Some(
|
||||
split(&matches.opt_strs("host"))
|
||||
|
||||
Reference in New Issue
Block a user