Skip to content

Commit

Permalink
Auto merge of #10784 - tedinski:fix-10783, r=epage
Browse files Browse the repository at this point in the history
Allow '.' in workspace.default-members in non-virtual workspaces.
  • Loading branch information
bors committed Jul 16, 2022
2 parents d583b21 + 917b87e commit 6fc517b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down
29 changes: 29 additions & 0 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6fc517b

Please sign in to comment.