Remove ONLY_BUILD_TARGETS.

All cases where it is used can be replaced by substituing run.host for
run.builder.build.build; that is its only effect. As such, it is
removable.
This commit is contained in:
Mark Simulacrum 2018-02-11 15:39:09 -07:00
parent 604d4ce757
commit 1191510881
3 changed files with 5 additions and 26 deletions

View File

@ -60,9 +60,6 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
/// Run this rule for all hosts without cross compiling.
const ONLY_HOSTS: bool = false;
/// Run this rule for all targets, but only with the native host.
const ONLY_BUILD_TARGETS: bool = false;
/// Only run this step with the build triple as host and target.
const ONLY_BUILD: bool = false;
@ -101,7 +98,6 @@ pub struct RunConfig<'a> {
struct StepDescription {
default: bool,
only_hosts: bool,
only_build_targets: bool,
only_build: bool,
should_run: fn(ShouldRun) -> ShouldRun,
make_run: fn(RunConfig),
@ -138,7 +134,6 @@ impl StepDescription {
StepDescription {
default: S::DEFAULT,
only_hosts: S::ONLY_HOSTS,
only_build_targets: S::ONLY_BUILD_TARGETS,
only_build: S::ONLY_BUILD,
should_run: S::should_run,
make_run: S::make_run,
@ -155,7 +150,7 @@ impl StepDescription {
self.name, builder.config.exclude);
}
let build = builder.build;
let hosts = if self.only_build_targets || self.only_build {
let hosts = if self.only_build {
build.build_triple()
} else {
&build.hosts

View File

@ -70,7 +70,6 @@ pub struct Docs {
impl Step for Docs {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/doc")
@ -271,7 +270,6 @@ pub struct Mingw {
impl Step for Mingw {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.never()
@ -331,7 +329,6 @@ impl Step for Rustc {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/librustc")
@ -561,7 +558,6 @@ pub struct Std {
impl Step for Std {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/libstd")
@ -569,7 +565,7 @@ impl Step for Std {
fn make_run(run: RunConfig) {
run.builder.ensure(Std {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
target: run.target,
});
}
@ -638,7 +634,6 @@ pub struct Analysis {
impl Step for Analysis {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
let builder = run.builder;
@ -647,7 +642,7 @@ impl Step for Analysis {
fn make_run(run: RunConfig) {
run.builder.ensure(Analysis {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
compiler: run.builder.compiler(run.builder.top_stage, run.builder.build.build),
target: run.target,
});
}
@ -755,8 +750,6 @@ impl Step for Src {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_BUILD: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src")
@ -851,8 +844,6 @@ impl Step for PlainSourceTarball {
type Output = PathBuf;
const DEFAULT: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_BUILD: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
let builder = run.builder;
@ -1007,7 +998,6 @@ pub struct Cargo {
impl Step for Cargo {
type Output = PathBuf;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
@ -1095,7 +1085,6 @@ pub struct Rls {
impl Step for Rls {
type Output = Option<PathBuf>;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
@ -1177,7 +1166,6 @@ pub struct Rustfmt {
impl Step for Rustfmt {
type Output = Option<PathBuf>;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
@ -1263,7 +1251,6 @@ pub struct Extended {
impl Step for Extended {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
@ -1274,7 +1261,7 @@ impl Step for Extended {
fn make_run(run: RunConfig) {
run.builder.ensure(Extended {
stage: run.builder.top_stage,
host: run.host,
host: run.builder.build.build,
target: run.target,
});
}
@ -1692,9 +1679,7 @@ pub struct HashSign;
impl Step for HashSign {
type Output = ();
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = true;
const ONLY_BUILD: bool = true;
fn should_run(run: ShouldRun) -> ShouldRun {
run.path("hash-and-sign")

View File

@ -161,7 +161,6 @@ macro_rules! install {
impl Step for $name {
type Output = ();
const DEFAULT: bool = true;
const ONLY_BUILD_TARGETS: bool = true;
const ONLY_HOSTS: bool = $only_hosts;
$(const $c: bool = true;)*
@ -174,7 +173,7 @@ macro_rules! install {
run.builder.ensure($name {
stage: run.builder.top_stage,
target: run.target,
host: run.host,
host: run.builder.build.build,
});
}