Skip to content

fix(bindeps): load targets before downloading artifacts#17073

Open
npmccallum wants to merge 2 commits into
rust-lang:masterfrom
npmccallum:issue-16881-bindeps-panic
Open

fix(bindeps): load targets before downloading artifacts#17073
npmccallum wants to merge 2 commits into
rust-lang:masterfrom
npmccallum:issue-16881-bindeps-panic

Conversation

@npmccallum

Copy link
Copy Markdown
Contributor

Artifact dependencies can introduce additional compile targets through manifest target fields. Cargo loaded those targets during feature resolution for some paths, but PackageSet::download_accessible could encounter a transitive artifact build-dependency before the target data had been populated.

When that happened, dependency platform filtering asked for cfg data for an unknown target and panicked. Load artifact dependency targets during the same traversal that follows them for downloads, so target cfg data is available before filtering recurses into that target.

The regression covers a git dependency whose build script has a path artifact build-dependency with an explicit target, matching the topology reported in the issue.

Closes #16881.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2026
@rustbot

rustbot commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@epage epage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only looked at the PR structure. I'll need to look into this on a desktop. Other reviewers are free to look at this if they get to it before me.

View changes since this review

}

#[cargo_test]
fn transitive_build_script_artifact_dependency_with_valid_target_does_not_panic() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add coverage for a git dependency whose build script has a path artifact
build-dependency with an explicit target.

This matches the topology from rust-lang#16881 and records the expected successful
build behavior before changing target loading.
Artifact dependencies can introduce additional compile targets through
manifest target fields. Cargo loaded those targets during feature
resolution for some paths, but PackageSet::download_accessible could
encounter a transitive artifact build-dependency before the target data
had been populated.

When that happened, dependency platform filtering asked for cfg data for
an unknown target and panicked. Load artifact dependency targets during
the same traversal that follows them for downloads, so target cfg data is
available before filtering recurses into that target.

Closes rust-lang#16881.
@npmccallum npmccallum force-pushed the issue-16881-bindeps-panic branch from 54ddd7f to b72f42d Compare June 4, 2026 17:32
@rustbot

rustbot commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@npmccallum

Copy link
Copy Markdown
Contributor Author

Thanks, addressed the structure feedback by splitting this into two commits:

  1. test(bindeps): cover transitive artifact target download
  2. fix(bindeps): load targets before downloading artifacts

The test-only commit passes locally, and the final commit keeps the production change separate.

Verified:

cargo test --test testsuite artifact_dep::transitive_build_script_artifact_dependency_with_valid_target_does_not_panic -- --nocapture
cargo fmt --check
git diff --check upstream/master..issue-16881-bindeps-panic

@epage

epage commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

The test-only commit passes locally, and the final commit keeps the production change separate.

If that is the case, then why does the fix not change the tests?

Also, what does git diff --checked have to do with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bindeps crashes cargo

3 participants