File tree 2 files changed +12
-1
lines changed
test/rust_analyzer/generated_srcs_test
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ mod tests {
48
48
. find ( |c| & c. display_name == "generated_srcs" )
49
49
. unwrap ( ) ;
50
50
assert ! ( gen . root_module. starts_with( "/" ) ) ;
51
- assert ! ( gen . root_module. ends_with( "/lib.rs" ) ) ;
51
+ assert ! ( gen
52
+ . root_module
53
+ . ends_with( "rules_rust_test_rust_analyzer/lib.rs" ) ) ;
52
54
53
55
let include_dirs = & gen. source . as_ref ( ) . unwrap ( ) . include_dirs ;
54
56
assert ! ( include_dirs. len( ) == 1 ) ;
Original file line number Diff line number Diff line change @@ -208,6 +208,15 @@ fn consolidate_crate_specs(crate_specs: Vec<CrateSpec>) -> anyhow::Result<BTreeS
208
208
existing. proc_macro_dylib_path . replace ( dylib_path. clone ( ) ) ;
209
209
}
210
210
}
211
+
212
+ // Prefer using workspace for root_module path if possible.
213
+ // A test crate might get an __EXEC_ROOT__-based root_module when depending
214
+ // on a library crate with mixed generated sources, for example.
215
+ if existing. root_module . starts_with ( "__EXEC_ROOT__" )
216
+ && spec. root_module . starts_with ( "__WORKSPACE__" )
217
+ {
218
+ existing. root_module = spec. root_module ;
219
+ }
211
220
} else {
212
221
consolidated_specs. insert ( spec. crate_id . clone ( ) , spec) ;
213
222
}
You can’t perform that action at this time.
0 commit comments