@@ -203,17 +203,29 @@ fn consolidate_crate_specs(crate_specs: Vec<CrateSpec>) -> anyhow::Result<BTreeS
203203 log:: debug!( "{:?}" , spec) ;
204204 if let Some ( existing) = consolidated_specs. get_mut ( & spec. crate_id ) {
205205 existing. deps . extend ( spec. deps ) ;
206+ existing. env . extend ( spec. env ) ;
206207
207208 spec. cfg . retain ( |cfg| !existing. cfg . contains ( cfg) ) ;
208209 existing. cfg . extend ( spec. cfg ) ;
209210
211+ if let Some ( source) = spec. source {
212+ let existing_source = existing. source . get_or_insert_with ( || CrateSpecSource {
213+ exclude_dirs : Vec :: new ( ) ,
214+ include_dirs : Vec :: new ( ) ,
215+ } ) ;
216+
217+ existing_source. exclude_dirs . extend ( source. exclude_dirs ) ;
218+ existing_source. include_dirs . extend ( source. include_dirs ) ;
219+ }
220+
210221 // display_name should match the library's crate name because Rust Analyzer
211222 // seems to use display_name for matching crate entries in rust-project.json
212223 // against symbols in source files. For more details, see
213224 // https://github.com/bazelbuild/rules_rust/issues/1032
214225 if spec. crate_type == CrateType :: Rlib {
215226 existing. display_name = spec. display_name ;
216- existing. crate_type = CrateType :: Rlib
227+ existing. crate_type = CrateType :: Rlib ;
228+ existing. build = spec. build ;
217229 }
218230
219231 // For proc-macro crates that exist within the workspace, there will be a
0 commit comments