mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-19 23:07:38 +00:00
refactor: Use MEDIUM durability for crate-graph changes, high for library source files
The idea here is that the crate graph may change over time, but library source file contents *never* will (or really never should). Disconnecting the two means that queries that depend on library sources will not need to re-validatewhen the crate graph changes (unless they depend on the crate graph in some capacity).
This commit is contained in:
parent
749fde9017
commit
454e4be40d
4 changed files with 19 additions and 15 deletions
|
@ -491,7 +491,7 @@ impl CrateGraphBuilder {
|
|||
if **old_all_crates != *all_crates {
|
||||
db.set_all_crates_with_durability(
|
||||
Arc::new(all_crates.into_boxed_slice()),
|
||||
Durability::HIGH,
|
||||
Durability::MEDIUM,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -549,30 +549,30 @@ impl CrateGraphBuilder {
|
|||
Entry::Occupied(entry) => {
|
||||
let old_crate = *entry.get();
|
||||
if crate_data != *old_crate.data(db) {
|
||||
old_crate.set_data(db).with_durability(Durability::HIGH).to(crate_data);
|
||||
old_crate.set_data(db).with_durability(Durability::MEDIUM).to(crate_data);
|
||||
}
|
||||
if krate.extra != *old_crate.extra_data(db) {
|
||||
old_crate
|
||||
.set_extra_data(db)
|
||||
.with_durability(Durability::HIGH)
|
||||
.with_durability(Durability::MEDIUM)
|
||||
.to(krate.extra.clone());
|
||||
}
|
||||
if krate.cfg_options != *old_crate.cfg_options(db) {
|
||||
old_crate
|
||||
.set_cfg_options(db)
|
||||
.with_durability(Durability::HIGH)
|
||||
.with_durability(Durability::MEDIUM)
|
||||
.to(krate.cfg_options.clone());
|
||||
}
|
||||
if krate.env != *old_crate.env(db) {
|
||||
old_crate
|
||||
.set_env(db)
|
||||
.with_durability(Durability::HIGH)
|
||||
.with_durability(Durability::MEDIUM)
|
||||
.to(krate.env.clone());
|
||||
}
|
||||
if krate.ws_data != *old_crate.workspace_data(db) {
|
||||
old_crate
|
||||
.set_workspace_data(db)
|
||||
.with_durability(Durability::HIGH)
|
||||
.with_durability(Durability::MEDIUM)
|
||||
.to(krate.ws_data.clone());
|
||||
}
|
||||
old_crate
|
||||
|
@ -585,7 +585,7 @@ impl CrateGraphBuilder {
|
|||
krate.cfg_options.clone(),
|
||||
krate.env.clone(),
|
||||
)
|
||||
.durability(Durability::HIGH)
|
||||
.durability(Durability::MEDIUM)
|
||||
.new(db);
|
||||
entry.insert(input);
|
||||
input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue