-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
parallel_compiler: hide dependencies behind feature #93787
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
}) | ||
} else { | ||
(FxHashMap::default(), Duration::new(0, 0)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make two closures? This would allow to avoid the cfg-if
dependency:
#[cfg(parallel_compiler)]
let pre_compile_cgus = |cgu_reuse: &[CguReuse]| { /* ... */ };
#[cfg(not(parallel_compiler))]
let pre_compile_cgus = |_: &[CguReuse]| (FxHashMap::default(), Duration::new(0, 0));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
036795b
to
acc3752
Compare
Err, looks like that I'm expecting, that this definition will work, Cargo.toml:
and compile indexmap with different features, depending on cfg, but it always builded with |
I don't think you can use It could be a Cargo feature, something like: [features]
parallel_compiler = ["indexmap/rustc-rayon", "rayon", "rayon-core"]
[dependencies]
indexmap = "1.8.0"
rayon = { version = "0.3.2", package = "rustc-rayon", optional = true }
rayon-core = { version = "0.3.2", package = "rustc-rayon-core", optional = true } Plumbing that feature from rustbuild through the crate tree might be challenging, or at least tedious. |
Looks like that should work, but propagating feature through rustc crates that way not fun at all. |
234d926
to
0785344
Compare
☔ The latest upstream changes (presumably #94350) made this pull request unmergeable. Please resolve the merge conflicts. |
Triage: |
…f feature gives change of builded crates: 238 -> 224.
0785344
to
008fc79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally both with and without parallel-compiler = true
and builds succeed.
📌 Commit 008fc79 has been approved by |
⌛ Testing commit 008fc79 with merge 6809057bc8259f310e1eb6d51d81018dab5010fc... |
@bors retry (yield to rollup containing this pr ) |
Rollup of 5 pull requests Successful merges: - rust-lang#93787 (parallel_compiler: hide dependencies behind feature) - rust-lang#95318 (diagnostics: correct generic bounds with doubled colon) - rust-lang#95328 (Fix yet another Box<T, A> ICE) - rust-lang#95397 (Link to std::io's platform-specific behavior disclaimer) - rust-lang#95407 (Inline u8::is_utf8_char_boundary) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Separate dependencies for
parallel_compiler
feature, so they will not be compiled if feature not selected, reducing number of compiled crates from 238 to 224.