Skip to content

Commit 36eafe5

Browse files
author
Collins Abitekaniza
committed
impl is_tool on Mode enum
make is_tool inherent prop of mode fix errors from rebase resolve issues from review
1 parent 1133397 commit 36eafe5

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

src/bootstrap/builder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ impl<'a> Builder<'a> {
806806
);
807807
}
808808

809-
if [Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) {
809+
if mode.is_tool() {
810810
// Tools like cargo and rls don't get debuginfo by default right now, but this can be
811811
// enabled in the config. Adding debuginfo makes them several times larger.
812812
if self.config.rust_debuginfo_tools {
@@ -1012,7 +1012,7 @@ impl<'a> Builder<'a> {
10121012
// be resolved because MinGW has the import library. The downside is we
10131013
// don't get newer functions from Windows, but we don't use any of them
10141014
// anyway.
1015-
if ![Mode::ToolRustc, Mode::ToolStd, Mode::ToolTest].iter().any(|m| &mode == m) {
1015+
if !mode.is_tool() {
10161016
cargo.env("WINAPI_NO_BUNDLED_LIBRARIES", "1");
10171017
}
10181018

src/bootstrap/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl Step for Rustdoc {
219219

220220
let mut cargo = prepare_tool_cargo(builder,
221221
compiler,
222-
Mode::Rustc,
222+
Mode::ToolRustc,
223223
target,
224224
"check",
225225
"src/tools/rustdoc");

src/bootstrap/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ impl Step for PlainSourceTarball {
953953
if !has_cargo_vendor {
954954
let mut cmd = builder.cargo(
955955
builder.compiler(0, builder.config.build),
956-
Mode::Tool,
956+
Mode::ToolRustc,
957957
builder.config.build,
958958
"install"
959959
);

src/bootstrap/doc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -799,13 +799,15 @@ impl Step for Rustdoc {
799799
builder.ensure(tool::Rustdoc { host: compiler.host });
800800

801801
// Symlink compiler docs to the output directory of rustdoc documentation.
802-
let out_dir = builder.stage_out(compiler, Mode::Tool).join(target).join("doc");
802+
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc");
803803
t!(fs::create_dir_all(&out_dir));
804804
builder.clear_if_dirty(&out, &rustdoc);
805805
t!(symlink_dir_force(&builder.config, &out, &out_dir));
806806

807807
// Build cargo command.
808-
let mut cargo = prepare_tool_cargo(builder, compiler, target, "doc", "src/tools/rustdoc");
808+
let mut cargo = prepare_tool_cargo(
809+
builder, compiler, Mode::ToolRustc, target, "doc", "src/tools/rustdoc");
810+
809811
cargo.env("RUSTDOCFLAGS", "--document-private-items");
810812
builder.run(&mut cargo);
811813
}

src/bootstrap/lib.rs

+9
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,15 @@ pub enum Mode {
324324
ToolRustc,
325325
}
326326

327+
impl Mode {
328+
pub fn is_tool(&self) -> bool {
329+
match self {
330+
Mode::ToolStd | Mode::ToolTest | Mode::ToolRustc => true,
331+
_ => false
332+
}
333+
}
334+
}
335+
327336
impl Build {
328337
/// Creates a new set of build configuration from the `flags` on the command
329338
/// line and the filesystem `config`.

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ impl Step for CrateRustdoc {
17291729

17301730
let mut cargo = tool::prepare_tool_cargo(builder,
17311731
compiler,
1732-
Mode::Rustc,
1732+
Mode::ToolRustc,
17331733
target,
17341734
test_kind.subcommand(),
17351735
"src/tools/rustdoc");

0 commit comments

Comments
 (0)