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

Do not attempt to recompile codegen backend(s) with --keep-stage #52360

Merged
merged 2 commits into from
Jul 15, 2018
Merged
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
70 changes: 36 additions & 34 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,14 @@ impl Step for Std {
let target = self.target;
let compiler = self.compiler;

if let Some(keep_stage) = builder.config.keep_stage {
if keep_stage <= compiler.stage {
println!("Warning: Using a potentially old libstd. This may not behave well.");
builder.ensure(StdLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}
if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old libstd. This may not behave well.");
builder.ensure(StdLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}

builder.ensure(StartupObjects { compiler, target });
Expand Down Expand Up @@ -362,20 +360,18 @@ impl Step for Test {
let target = self.target;
let compiler = self.compiler;

if let Some(keep_stage) = builder.config.keep_stage {
if keep_stage <= compiler.stage {
println!("Warning: Using a potentially old libtest. This may not behave well.");
builder.ensure(TestLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}
}

builder.ensure(Std { compiler, target });

if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old libtest. This may not behave well.");
builder.ensure(TestLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}

if builder.force_use_stage1(compiler, target) {
builder.ensure(Test {
compiler: builder.compiler(1, builder.config.build),
Expand Down Expand Up @@ -490,20 +486,18 @@ impl Step for Rustc {
let compiler = self.compiler;
let target = self.target;

if let Some(keep_stage) = builder.config.keep_stage {
if keep_stage <= compiler.stage {
println!("Warning: Using a potentially old librustc. This may not behave well.");
builder.ensure(RustcLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}
}

builder.ensure(Test { compiler, target });

if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old librustc. This may not behave well.");
builder.ensure(RustcLink {
compiler: compiler,
target_compiler: compiler,
target,
});
return;
}

if builder.force_use_stage1(compiler, target) {
builder.ensure(Rustc {
compiler: builder.compiler(1, builder.config.build),
Expand Down Expand Up @@ -660,6 +654,14 @@ impl Step for CodegenBackend {

builder.ensure(Rustc { compiler, target });

if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old codegen backend. \
This may not behave well.");
// Codegen backends are linked separately from this step today, so we don't do
// anything here.
return;
}

if builder.force_use_stage1(compiler, target) {
builder.ensure(CodegenBackend {
compiler: builder.compiler(1, builder.config.build),
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub struct Config {

pub on_fail: Option<String>,
pub stage: Option<u32>,
pub keep_stage: Option<u32>,
pub keep_stage: Vec<u32>,
pub src: PathBuf,
pub jobs: Option<u32>,
pub cmd: Subcommand,
Expand Down
8 changes: 5 additions & 3 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Flags {
pub verbose: usize, // number of -v args; each extra -v after the first is passed to Cargo
pub on_fail: Option<String>,
pub stage: Option<u32>,
pub keep_stage: Option<u32>,
pub keep_stage: Vec<u32>,

pub host: Vec<Interned<String>>,
pub target: Vec<Interned<String>>,
Expand Down Expand Up @@ -122,7 +122,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
opts.optopt("", "on-fail", "command to run on failure", "CMD");
opts.optflag("", "dry-run", "dry run; don't build anything");
opts.optopt("", "stage", "stage to build", "N");
opts.optopt("", "keep-stage", "stage to keep without recompiling", "N");
opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling", "N");
opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
opts.optflag("h", "help", "print this help message");
Expand Down Expand Up @@ -402,7 +402,9 @@ Arguments:
dry_run: matches.opt_present("dry-run"),
on_fail: matches.opt_str("on-fail"),
rustc_error_format: matches.opt_str("error-format"),
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
keep_stage: matches.opt_strs("keep-stage")
.into_iter().map(|j| j.parse().unwrap())
.collect(),
host: split(matches.opt_strs("host"))
.into_iter()
.map(|x| INTERNER.intern_string(x))
Expand Down