Skip to content

Commit

Permalink
Merge include/exclude dirs when consolidating crate specs
Browse files Browse the repository at this point in the history
This fixes //test/rust_analyzer:rust_analyzer_test which seems to
currently fail on main branch.
  • Loading branch information
martingms committed Dec 18, 2024
1 parent 0e2fbbf commit 367aa40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/rust_analyzer/aquery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ fn consolidate_crate_specs(crate_specs: Vec<CrateSpec>) -> anyhow::Result<BTreeS
spec.cfg.retain(|cfg| !existing.cfg.contains(cfg));
existing.cfg.extend(spec.cfg);

match (existing.source.as_mut(), spec.source) {
(None, new @ Some(_)) => existing.source = new,
(Some(existing_source), Some(new_source)) => {
existing_source.exclude_dirs.extend(new_source.exclude_dirs);
existing_source.include_dirs.extend(new_source.include_dirs);
}
_ => (),
}

// display_name should match the library's crate name because Rust Analyzer
// seems to use display_name for matching crate entries in rust-project.json
// against symbols in source files. For more details, see
Expand Down

0 comments on commit 367aa40

Please sign in to comment.