diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index ee74c31a4de..2adf13a5b1a 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -686,6 +686,8 @@ impl<'cfg> Workspace<'cfg> { })?; } + self.find_path_deps(&root_manifest_path, &root_manifest_path, false)?; + if let Some(default) = default_members_paths { for path in default { let normalized_path = paths::normalize_path(&path); @@ -716,7 +718,7 @@ impl<'cfg> Workspace<'cfg> { self.default_members.push(self.current_manifest.clone()) } - self.find_path_deps(&root_manifest_path, &root_manifest_path, false) + Ok(()) } fn find_path_deps( diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index d58b0220a21..52f41b1183f 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -119,6 +119,35 @@ fn non_virtual_default_members_build_other_member() { .run(); } +#[cargo_test] +fn non_virtual_default_members_build_root_project() { + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.1.0" + authors = [] + + [workspace] + members = ["bar"] + default-members = ["."] + "#, + ) + .file("src/main.rs", "fn main() {}") + .file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0")) + .file("bar/src/lib.rs", "pub fn bar() {}") + .build(); + + p.cargo("build") + .with_stderr( + "[..] Compiling foo v0.1.0 ([..])\n\ + [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n", + ) + .run(); +} + #[cargo_test] fn inferred_root() { let p = project()