Skip to content

Report multiple "failed to get dependency" errors at once #15380

Open
@QuarticCat

Description

@QuarticCat

Problem

We have many cargo packages spread across many repos. When someone enters a project, we need to grant access to dependency repos. And it's easy to miss several ones. So we often see that

  1. Cargo failed to get a dependency.
  2. The user reported that error.
  3. We fixed the permission issue.
  4. The user reran Cargo and got another "failed to get dependency" error. Back to 2.

If Cargo can report multiple "failed to get dependency" errors at once, we could save some RTTs in this scenario.

Related code:

// Next, transform all dependencies into a list of possible candidates
// which can satisfy that dependency.
let mut all_ready = true;
let mut deps = deps
.into_iter()
.filter_map(|(dep, features)| match self.query(&dep, first_version) {
Poll::Ready(Ok(candidates)) => Some(Ok((dep, candidates, features))),
Poll::Pending => {
all_ready = false;
// we can ignore Pending deps, resolve will be repeatedly called
// until there are none to ignore
None
}
Poll::Ready(Err(e)) => Some(Err(e).with_context(|| {
format!(
"failed to get `{}` as a dependency of {}",
dep.package_name(),
describe_path_in_context(cx, &candidate.package_id()),
)
})),
})
.collect::<CargoResult<Vec<DepInfo>>>()?;

Proposed Solution

No response

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions