mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Allow '.' in workspace.default-members in non-virtual workspaces.
This commit is contained in:
parent
92ff479275
commit
380be40922
@ -690,7 +690,9 @@ impl<'cfg> Workspace<'cfg> {
|
||||
for path in default {
|
||||
let normalized_path = paths::normalize_path(&path);
|
||||
let manifest_path = normalized_path.join("Cargo.toml");
|
||||
if !self.members.contains(&manifest_path) {
|
||||
if !self.members.contains(&manifest_path)
|
||||
&& (self.is_virtual() || manifest_path != root_manifest_path)
|
||||
{
|
||||
// default-members are allowed to be excluded, but they
|
||||
// still must be referred to by the original (unfiltered)
|
||||
// members list. Note that we aren't testing against the
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user