mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Lift out workspace related data into a separate query to preserve crategraph deduplication
This commit is contained in:
parent
8905f86d8a
commit
db04f514f2
10 changed files with 98 additions and 97 deletions
|
@ -2,8 +2,8 @@
|
|||
use std::{iter, mem, str::FromStr, sync};
|
||||
|
||||
use base_db::{
|
||||
CrateDisplayName, CrateGraph, CrateId, CrateName, CrateOrigin, Dependency, Env, FileChange,
|
||||
FileSet, LangCrateOrigin, SourceRoot, SourceRootDatabase, Version, VfsPath,
|
||||
CrateDisplayName, CrateGraph, CrateId, CrateName, CrateOrigin, CrateWorkspaceData, Dependency,
|
||||
Env, FileChange, FileSet, LangCrateOrigin, SourceRoot, SourceRootDatabase, Version, VfsPath,
|
||||
};
|
||||
use cfg::CfgOptions;
|
||||
use hir_expand::{
|
||||
|
@ -354,16 +354,20 @@ impl ChangeFixture {
|
|||
};
|
||||
roots.push(root);
|
||||
|
||||
let mut change = ChangeWithProcMacros {
|
||||
source_change,
|
||||
proc_macros: Some(proc_macros.build()),
|
||||
toolchains: Some(iter::repeat(toolchain).take(crate_graph.len()).collect()),
|
||||
target_data_layouts: Some(
|
||||
iter::repeat(target_data_layout).take(crate_graph.len()).collect(),
|
||||
),
|
||||
};
|
||||
let mut change =
|
||||
ChangeWithProcMacros { source_change, proc_macros: Some(proc_macros.build()) };
|
||||
|
||||
change.source_change.set_roots(roots);
|
||||
change.source_change.set_ws_data(
|
||||
crate_graph
|
||||
.iter()
|
||||
.zip(iter::repeat(From::from(CrateWorkspaceData {
|
||||
proc_macro_cwd: None,
|
||||
data_layout: target_data_layout,
|
||||
toolchain,
|
||||
})))
|
||||
.collect(),
|
||||
);
|
||||
change.source_change.set_crate_graph(crate_graph);
|
||||
|
||||
ChangeFixture { file_position, files, change }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue