Skip to content

Commit

Permalink
Don't ignore errors in workspace manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Dec 15, 2016
1 parent d902f59 commit 6d70492
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ impl<'cfg> Workspace<'cfg> {
while let Some(path) = cur {
let manifest = path.join("Cargo.toml");
debug!("find_root - trying {}", manifest.display());
if let Ok(pkg) = self.packages.load(&manifest) {
match *pkg.workspace_config() {
if manifest.exists() {
match *self.packages.load(&manifest)?.workspace_config() {
WorkspaceConfig::Root { .. } => {
debug!("find_root - found");
return Ok(Some(manifest))
Expand Down
19 changes: 19 additions & 0 deletions tests/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1055,3 +1055,22 @@ fn workspace_with_transitive_dev_deps() {
assert_that(p.cargo("test").args(&["-p", "bar"]),
execs().with_status(0));
}

#[test]
fn error_if_parent_cargo_toml_is_invalid() {
let p = project("foo")
.file("Cargo.toml", "Totally not a TOML file")
.file("bar/Cargo.toml", r#"
[project]
name = "bar"
version = "0.1.0"
authors = []
"#)
.file("bar/src/main.rs", "fn main() {}");
p.build();

assert_that(p.cargo("build").cwd(p.root().join("bar")),
execs().with_status(101)
.with_stderr_contains("\
[ERROR] failed to parse manifest at `[..]`"));
}

0 comments on commit 6d70492

Please sign in to comment.