mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Remove the Default impl for SourceRoot
Let's be always explicit whether we create a library (i.e., an immutable dependency) or a local `SourceRoot`, since it can have a large impact on the validation performance in salsa. (we found it the hard way recently, where the `Default` instance made it quite tricky to spot a bug) Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
This commit is contained in:
parent
2ffaad10f2
commit
d761435ba0
3 changed files with 9 additions and 8 deletions
|
@ -176,7 +176,8 @@ impl RootDatabase {
|
|||
if !change.new_roots.is_empty() {
|
||||
let mut local_roots = Vec::clone(&self.local_roots());
|
||||
for (root_id, is_local) in change.new_roots {
|
||||
let root = if is_local { SourceRoot::new() } else { SourceRoot::new_library() };
|
||||
let root =
|
||||
if is_local { SourceRoot::new_local() } else { SourceRoot::new_library() };
|
||||
let durability = durability(&root);
|
||||
self.set_source_root_with_durability(root_id, Arc::new(root), durability);
|
||||
if is_local {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue