diff --git a/src/cargo/ops/cargo_read_manifest.rs b/src/cargo/ops/cargo_read_manifest.rs index 324085734..262e502af 100644 --- a/src/cargo/ops/cargo_read_manifest.rs +++ b/src/cargo/ops/cargo_read_manifest.rs @@ -1,7 +1,7 @@ use std::io::File; use util; use core::{Package,Manifest,SourceId}; -use util::{CargoResult, human}; +use util::{CargoResult, human, important_paths}; pub fn read_manifest(contents: &[u8], source_id: &SourceId) -> CargoResult<(Manifest, Vec)> @@ -24,7 +24,8 @@ pub fn read_package(path: &Path, source_id: &SourceId) pub fn read_packages(path: &Path, source_id: &SourceId) -> CargoResult> { - let (pkg, nested) = try!(read_package(&path.join("Cargo.toml"), source_id)); + let manifest = try!(important_paths::find_project_manifest_exact(path, "Cargo.toml")); + let (pkg, nested) = try!(read_package(&manifest, source_id)); let mut ret = vec!(pkg); for p in nested.iter() { diff --git a/tests/test_cargo_compile_path_deps.rs b/tests/test_cargo_compile_path_deps.rs index f01a18549..7b4406eb9 100644 --- a/tests/test_cargo_compile_path_deps.rs +++ b/tests/test_cargo_compile_path_deps.rs @@ -354,3 +354,26 @@ test!(nested_deps_recompile { FRESH, bar.display(), COMPILING, p.root().display()))); }) + +test!(error_message_for_missing_manifest { + let p = project("foo") + .file("Cargo.toml", r#" + [project] + + name = "foo" + version = "0.5.0" + authors = ["wycats@example.com"] + + [dependencies.bar] + + path = "src/bar" + "#) + .file("src/bar/not-a-manifest", ""); + + assert_that(p.cargo_process("cargo-build"), + execs() + .with_status(101) + .with_stderr(format!("Could not find `Cargo.toml` in `{}`\n", + p.root().join_many(&["src", "bar"]).display()))); + +})