File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -690,7 +690,9 @@ impl<'cfg> Workspace<'cfg> {
690
690
for path in default {
691
691
let normalized_path = paths:: normalize_path ( & path) ;
692
692
let manifest_path = normalized_path. join ( "Cargo.toml" ) ;
693
- if !self . members . contains ( & manifest_path) {
693
+ if !self . members . contains ( & manifest_path)
694
+ && ( self . is_virtual ( ) || manifest_path != root_manifest_path)
695
+ {
694
696
// default-members are allowed to be excluded, but they
695
697
// still must be referred to by the original (unfiltered)
696
698
// members list. Note that we aren't testing against the
Original file line number Diff line number Diff line change @@ -119,6 +119,35 @@ fn non_virtual_default_members_build_other_member() {
119
119
. run ( ) ;
120
120
}
121
121
122
+ #[ cargo_test]
123
+ fn non_virtual_default_members_build_root_project ( ) {
124
+ let p = project ( )
125
+ . file (
126
+ "Cargo.toml" ,
127
+ r#"
128
+ [project]
129
+ name = "foo"
130
+ version = "0.1.0"
131
+ authors = []
132
+
133
+ [workspace]
134
+ members = ["bar"]
135
+ default-members = ["."]
136
+ "# ,
137
+ )
138
+ . file ( "src/main.rs" , "fn main() {}" )
139
+ . file ( "bar/Cargo.toml" , & basic_manifest ( "bar" , "0.1.0" ) )
140
+ . file ( "bar/src/lib.rs" , "pub fn bar() {}" )
141
+ . build ( ) ;
142
+
143
+ p. cargo ( "build" )
144
+ . with_stderr (
145
+ "[..] Compiling foo v0.1.0 ([..])\n \
146
+ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n ",
147
+ )
148
+ . run ( ) ;
149
+ }
150
+
122
151
#[ cargo_test]
123
152
fn inferred_root ( ) {
124
153
let p = project ( )
You can’t perform that action at this time.
0 commit comments