Skip to content

Commit 87958ad

Browse files
committed
Avoid building C++ for rustc_llvm with --compile-time-deps
This saves about 30s.
1 parent 3fe3edb commit 87958ad

File tree

7 files changed

+17
-0
lines changed

7 files changed

+17
-0
lines changed

compiler/rustc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ features = ['unprefixed_malloc_on_supported_platforms']
2727

2828
[features]
2929
# tidy-alphabetical-start
30+
check_only = ['rustc_driver_impl/check_only']
3031
jemalloc = ['dep:tikv-jemalloc-sys']
3132
llvm = ['rustc_driver_impl/llvm']
3233
max_level_info = ['rustc_driver_impl/max_level_info']

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ serde_json = "1"
4343
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
4444
tracing = "0.1"
4545
# tidy-alphabetical-end
46+
47+
[features]
48+
check_only = ["rustc_llvm/check_only"]

compiler/rustc_driver_impl/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ ctrlc = "3.4.4"
7272

7373
[features]
7474
# tidy-alphabetical-start
75+
check_only = ['rustc_interface/check_only']
7576
llvm = ['rustc_interface/llvm']
7677
max_level_info = ['rustc_log/max_level_info']
7778
rustc_randomized_layouts = [

compiler/rustc_interface/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@ rustc_abi = { path = "../rustc_abi" }
5656

5757
[features]
5858
# tidy-alphabetical-start
59+
check_only = ['rustc_codegen_llvm?/check_only']
5960
llvm = ['dep:rustc_codegen_llvm']
6061
# tidy-alphabetical-end

compiler/rustc_llvm/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ libc = "0.2.73"
1414
# pinned `cc` in `rustc_codegen_ssa` if you update `cc` here.
1515
cc = "=1.2.16"
1616
# tidy-alphabetical-end
17+
18+
[features]
19+
# Used by ./x.py check --compile-time-deps to skip building C++ code
20+
check_only = []

compiler/rustc_llvm/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ fn output(cmd: &mut Command) -> String {
106106
}
107107

108108
fn main() {
109+
if cfg!(feature = "check_only") {
110+
return;
111+
}
112+
109113
for component in REQUIRED_COMPONENTS.iter().chain(OPTIONAL_COMPONENTS.iter()) {
110114
println!("cargo:rustc-check-cfg=cfg(llvm_component,values(\"{component}\"))");
111115
}

src/bootstrap/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@ impl Build {
775775
if self.config.rust_randomize_layout && check("rustc_randomized_layouts") {
776776
features.push("rustc_randomized_layouts");
777777
}
778+
if self.config.compile_time_deps && kind == Kind::Check {
779+
features.push("check_only");
780+
}
778781

779782
// If debug logging is on, then we want the default for tracing:
780783
// https://github.com/tokio-rs/tracing/blob/3dd5c03d907afdf2c39444a29931833335171554/tracing/src/level_filters.rs#L26

0 commit comments

Comments
 (0)