Skip to content

Commit 3117e19

Browse files
committed
Use a constant for unstable features needed by compiletest
1 parent e62d47d commit 3117e19

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Diff for: src/bootstrap/src/core/build_steps/check.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use crate::core::build_steps::compile::{
44
add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make,
55
};
6-
use crate::core::build_steps::tool::{SourceType, prepare_tool_cargo};
6+
use crate::core::build_steps::tool::{COMPILETEST_ALLOW_FEATURES, SourceType, prepare_tool_cargo};
77
use crate::core::builder::{
88
self, Alias, Builder, Kind, RunConfig, ShouldRun, Step, crate_description,
99
};
@@ -416,7 +416,7 @@ impl Step for Compiletest {
416416
&[],
417417
);
418418

419-
cargo.allow_features("test");
419+
cargo.allow_features(COMPILETEST_ALLOW_FEATURES);
420420

421421
// For ./x.py clippy, don't run with --all-targets because
422422
// linting tests and benchmarks can produce very noisy results

Diff for: src/bootstrap/src/core/build_steps/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::core::build_steps::doc::DocumentationFormat;
1515
use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags};
1616
use crate::core::build_steps::llvm::get_llvm_version;
1717
use crate::core::build_steps::synthetic_targets::MirOptPanicAbortSyntheticTarget;
18-
use crate::core::build_steps::tool::{self, SourceType, Tool};
18+
use crate::core::build_steps::tool::{self, COMPILETEST_ALLOW_FEATURES, SourceType, Tool};
1919
use crate::core::build_steps::toolstate::ToolState;
2020
use crate::core::build_steps::{compile, dist, llvm};
2121
use crate::core::builder::{
@@ -721,7 +721,7 @@ impl Step for CompiletestTest {
721721
SourceType::InTree,
722722
&[],
723723
);
724-
cargo.allow_features("test");
724+
cargo.allow_features(COMPILETEST_ALLOW_FEATURES);
725725
run_cargo_test(cargo, &[], &[], "compiletest self test", host, builder);
726726
}
727727
}

Diff for: src/bootstrap/src/core/build_steps/tool.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,11 @@ macro_rules! bootstrap_tool {
445445
SourceType::InTree
446446
},
447447
extra_features: vec![],
448-
allow_features: concat!($($allow_features)*),
448+
allow_features: {
449+
let mut _value = "";
450+
$( _value = $allow_features; )?
451+
_value
452+
},
449453
cargo_args: vec![],
450454
artifact_kind: if false $(|| $artifact_kind == ToolArtifactKind::Library)* {
451455
ToolArtifactKind::Library
@@ -459,6 +463,8 @@ macro_rules! bootstrap_tool {
459463
}
460464
}
461465

466+
pub(crate) const COMPILETEST_ALLOW_FEATURES: &str = "test";
467+
462468
bootstrap_tool!(
463469
// This is marked as an external tool because it includes dependencies
464470
// from submodules. Trying to keep the lints in sync between all the repos
@@ -469,7 +475,7 @@ bootstrap_tool!(
469475
Tidy, "src/tools/tidy", "tidy";
470476
Linkchecker, "src/tools/linkchecker", "linkchecker";
471477
CargoTest, "src/tools/cargotest", "cargotest";
472-
Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true, allow_features = "test";
478+
Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true, allow_features = COMPILETEST_ALLOW_FEATURES;
473479
BuildManifest, "src/tools/build-manifest", "build-manifest";
474480
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
475481
RustInstaller, "src/tools/rust-installer", "rust-installer";
@@ -484,7 +490,7 @@ bootstrap_tool!(
484490
GenerateCopyright, "src/tools/generate-copyright", "generate-copyright";
485491
SuggestTests, "src/tools/suggest-tests", "suggest-tests";
486492
GenerateWindowsSys, "src/tools/generate-windows-sys", "generate-windows-sys";
487-
RustdocGUITest, "src/tools/rustdoc-gui-test", "rustdoc-gui-test", is_unstable_tool = true, allow_features = "test";
493+
RustdocGUITest, "src/tools/rustdoc-gui-test", "rustdoc-gui-test", is_unstable_tool = true, allow_features = COMPILETEST_ALLOW_FEATURES;
488494
CoverageDump, "src/tools/coverage-dump", "coverage-dump";
489495
WasmComponentLd, "src/tools/wasm-component-ld", "wasm-component-ld", is_unstable_tool = true, allow_features = "min_specialization";
490496
UnicodeTableGenerator, "src/tools/unicode-table-generator", "unicode-table-generator";

0 commit comments

Comments
 (0)