Skip to content
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

Ignore broken Cargo.toml in git sources #7947

Merged
merged 1 commit into from
Mar 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/cargo/ops/cargo_read_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,26 @@ fn read_nested_packages(
if !source_id.is_registry() {
for p in nested.iter() {
let path = util::normalize_path(&path.join(p));
read_nested_packages(&path, all_packages, source_id, config, visited, errors)?;
let result =
read_nested_packages(&path, all_packages, source_id, config, visited, errors);
// Ignore broken manifests found on git repositories.
//
// A well formed manifest might still fail to load due to reasons
// like referring to a "path" that requires an extra build step.
//
// See https://github.com/rust-lang/cargo/issues/6822.
if let Err(err) = result {
if source_id.is_git() {
info!(
"skipping nested package found at `{}`: {:?}",
path.display(),
&err,
);
errors.push(err);
} else {
return Err(err);
}
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions tests/testsuite/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ fn cargo_compile_with_malformed_nested_paths() {
"#,
)
.file("vendor/dep2/Cargo.toml", "!INVALID!")
.file(
"vendor/dep3/Cargo.toml",
r#"
[project]
name = "dep3"
version = "0.5.0"
[dependencies]
subdep1 = { path = "../require-extra-build-step" }"#,
)
.file("vendor/dep3/src/lib.rs", "")
});

let p = project()
Expand Down