-
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
Fix panic when running cargo tree on a package with a cross compiled bindep #14593
Fix panic when running cargo tree on a package with a cross compiled bindep #14593
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
aa14297
to
7ae6261
Compare
For continuity, probably Also note I have not re-added |
☔ The latest upstream changes (presumably #14618) made this pull request unmergeable. Please resolve the merge conflicts. |
7ae6261
to
3a7edc2
Compare
FeaturesFor::HostDep | ||
} else { | ||
features_for | ||
let dep_features_for = match dep |
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 for reviving this PR!
However, this is missing an important part of my original patch. Please see my previous comment :)
I am tempted to merge this PR as it fixes some panics. I will be more existed if we can implement the design proposed here: #10593 (comment).
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.
I'm very happy to keep implementing the design! (I'm now emotionally invested), but I think we should split it into separate PRs. I've updated the PR message to explain each commit as they currently exist.
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.
Update: Moved the proposed design change work to #14658 to keep this PR clear.
…hanglo improve error reporting when feature not found in `activated_features` Pulls the error message refactor out of #14593 (originally #13207) to improve error reporting when we fail to get the list of activated features enabled for the given package. It now fully lists the activated_features hashmap keys too. From the [original author](#13207 (comment)): > I moved `activated_features_int` into `activated_features` and `activated_features_unverified` as I was concerned of the performance cost of generating the full error when its not a fatal error and may occur many times. Old vs new error message: ```diff - activated_features for invalid package: features did not find PackageId { name: "bindep", version: "0.0.0", source: "[ROOT]/foo/bindep" } NormalOrDev + did not find features for (PackageId { name: "bindep", version: "0.0.0", source: "[ROOT]/foo/bindep" }, NormalOrDev) within activated_features: + [ + ( + PackageId { + name: "bindep", + version: "0.0.0", + source: "[ROOT]/foo/bindep", + }, + ArtifactDep( + CompileTarget { + name: "[ALT_TARGET]", + }, + ), + ), + ( + PackageId { + name: "foo", + version: "0.0.0", + source: "[ROOT]/foo", + }, + NormalOrDev, + ), + ] ``` r? weihanglo
☔ The latest upstream changes (presumably #14647) made this pull request unmergeable. Please resolve the merge conflicts. |
3d33aa1
to
39ce7c1
Compare
39ce7c1
to
d379632
Compare
d379632
to
4646712
Compare
tests/testsuite/artifact_dep.rs
Outdated
"#, | ||
), | ||
) | ||
.file("bar/src/lib.rs", "") |
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.
Should we put a bin here otherwise cargo check
always fails?
.file("bar/src/lib.rs", "") | |
.file("bar/src/main.rs", "") |
4646712
to
ed294ab
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.
Thanks!
While it doesn't really resolve all panics, at least we are one step forward :)
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 14 commits in 15fbd2f607d4defc87053b8b76bf5038f2483cf4..8c30ce53688e25f7e9d860b33cc914fb2957ca9a 2024-10-08 21:08:11 +0000 to 2024-10-15 16:43:16 +0000 - docs: More information on what is and isn't included by cargo package (rust-lang/cargo#14684) - fix(resolver): share conflict cache between activation retries (rust-lang/cargo#14692) - fix(git): dont fetch tags by default (rust-lang/cargo#14688) - Support package selection options like `--exclude` in `cargo publish` (rust-lang/cargo#14659) - docs: install options -> uninstall options (rust-lang/cargo#14682) - docs: tools should only interpret a line starting with `{` as JSON (rust-lang/cargo#14677) - cargo test --help: clarify --tests and --benches (rust-lang/cargo#14675) - docs(env): minor improvements in environment variables doc (rust-lang/cargo#14676) - docs: document official external commands (rust-lang/cargo#14669) - Fix panic when running cargo tree on a package with a cross compiled bindep (rust-lang/cargo#14593) - Remove the support for `Cargo.toml` of the cargo-script (rust-lang/cargo#14670) - docs(resolver): Lay groundwork for documenting MSRV-aware logic (rust-lang/cargo#14662) - chore(deps): update rust crate pulldown-cmark to 0.12.0 (rust-lang/cargo#14668) - Improve resolver speed (rust-lang/cargo#14663)
Update cargo 14 commits in 15fbd2f607d4defc87053b8b76bf5038f2483cf4..8c30ce53688e25f7e9d860b33cc914fb2957ca9a 2024-10-08 21:08:11 +0000 to 2024-10-15 16:43:16 +0000 - docs: More information on what is and isn't included by cargo package (rust-lang/cargo#14684) - fix(resolver): share conflict cache between activation retries (rust-lang/cargo#14692) - fix(git): dont fetch tags by default (rust-lang/cargo#14688) - Support package selection options like `--exclude` in `cargo publish` (rust-lang/cargo#14659) - docs: install options -> uninstall options (rust-lang/cargo#14682) - docs: tools should only interpret a line starting with `{` as JSON (rust-lang/cargo#14677) - cargo test --help: clarify --tests and --benches (rust-lang/cargo#14675) - docs(env): minor improvements in environment variables doc (rust-lang/cargo#14676) - docs: document official external commands (rust-lang/cargo#14669) - Fix panic when running cargo tree on a package with a cross compiled bindep (rust-lang/cargo#14593) - Remove the support for `Cargo.toml` of the cargo-script (rust-lang/cargo#14670) - docs(resolver): Lay groundwork for documenting MSRV-aware logic (rust-lang/cargo#14662) - chore(deps): update rust crate pulldown-cmark to 0.12.0 (rust-lang/cargo#14668) - Improve resolver speed (rust-lang/cargo#14663)
What does this PR try to resolve?
This is an attempt to close out @rukai's PR for #12358 and #10593 by adjusting the new integration test and resolving merge conflicts.
I have also separated the changes into atomic commits as per previous review.
How should we test and review this PR?
The integration test that has been edited here is sufficient, plus the new integration test that confirms a more specific case where
cargo tree
throws an error.Additional information
I have confirmed the test
artifact_dep_target_specified
fails on master branch and succeeds on this branch.The first commit fixes the panic and the integration test. Commits 2 and 3 add other tests that confirm behaviour mentioned in related issues.
Commits: