-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Override target crate-type for cargo rustc --crate-type
#10388
Conversation
3989df7
to
568b34e
Compare
I've tested this PR both on the repro (but that was included in tests already) and on As part of the initiative to improve compile times I've also benchmarked it, since the workaround to #10356 is currently preventing cargo's pipelining from working with both As a testament to the great work done on cargo's pipelining, my measurements show that building @weihanglo @ehuss is there something more I can do to help this PR along ? I can try to build the 800 or so popular crates we've been looking at in our extended benchmarks for example ? |
Thanks! @bors r+ |
📌 Commit 568b34ebe6f14605ededf6d619fc6821bbdd6a46 has been approved by |
⌛ Testing commit 568b34ebe6f14605ededf6d619fc6821bbdd6a46 with merge 496ffaefab260eb540fef5ab20cbd1f463599ce3... |
💔 Test failed - checks-actions |
@bors retry |
⌛ Testing commit 568b34ebe6f14605ededf6d619fc6821bbdd6a46 with merge ff397ae463bcea45a5eda8687bf0ffe78ea14416... |
💔 Test failed - checks-actions |
`--crate-type` usually defaults to `lib`, so the original assertion is somehow unuseful. Change to `cdylib` to make the test more robust.
unit.mode, | ||
unit.features.clone(), | ||
unit.is_std, | ||
unit.dep_hash, |
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.
The intern
API has recently been updated on master, so something similar to this looks to be needed now
unit.dep_hash, | |
unit.dep_hash, | |
unit.artifact, |
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.
Thanks! Just found that and rebased to master
Instead of writing override rules all over the compilation logic, this commit simply override the unit created by `generate_targets`. As a result, `cargo rustc --crate-type` behaves exactly as expected.
568b34e
to
b833643
Compare
@bors r+ |
📌 Commit b833643 has been approved by |
☀️ Test successful - checks-actions |
Thanks @weihanglo. I have a branch ready to fix |
11 changes in d6cdde584a1f15ea086bae922e20fd27f7165431..3d6970d50e30e797b8e26b2b9b1bdf92dc381f34 2022-02-22 19:55:51 +0000 to 2022-02-28 19:29:07 +0000: - rust-lang/cargo#10395 - rust-lang/cargo#10425 - rust-lang/cargo#10428 - rust-lang/cargo#10388 - rust-lang/cargo#10167 - rust-lang/cargo#10429 - rust-lang/cargo#10426 - rust-lang/cargo#10372 - rust-lang/cargo#10420 - rust-lang/cargo#10416 - rust-lang/cargo#10417
Update cargo 11 changes in d6cdde584a1f15ea086bae922e20fd27f7165431..3d6970d50e30e797b8e26b2b9b1bdf92dc381f34 2022-02-22 19:55:51 +0000 to 2022-02-28 19:29:07 +0000: - rust-lang/cargo#10395 - rust-lang/cargo#10425 - rust-lang/cargo#10428 - rust-lang/cargo#10388 - rust-lang/cargo#10167 - rust-lang/cargo#10429 - rust-lang/cargo#10426 - rust-lang/cargo#10372 - rust-lang/cargo#10420 - rust-lang/cargo#10416 - rust-lang/cargo#10417
What does this PR try to resolve?
Fixes #10356, fixes #10389
This might not be the best solution, but at least it avoids duplicating
overridden rules all over the compilation logic.
r? @ehuss since you're the reviewer of #10093
How should we test and review this PR?
Perform reproducible steps as #10356 described.
This PR includes a new test
rustc::build_with_crate_type_for_foo_with_deps
to validate the behavior of overridden crate-types with dependencies.