mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Allocate traits in scope upfront when type checking instead of recollecting them everytime
This commit is contained in:
parent
a8606e5363
commit
a51267c5e0
4 changed files with 66 additions and 50 deletions
|
@ -449,6 +449,15 @@ impl Resolver {
|
|||
traits
|
||||
}
|
||||
|
||||
pub fn traits_in_scope_from_block_scopes(&self) -> impl Iterator<Item = TraitId> + '_ {
|
||||
self.scopes()
|
||||
.filter_map(|scope| match scope {
|
||||
Scope::BlockScope(m) => Some(m.def_map[m.module_id].scope.traits()),
|
||||
_ => None,
|
||||
})
|
||||
.flatten()
|
||||
}
|
||||
|
||||
pub fn module(&self) -> ModuleId {
|
||||
let (def_map, local_id) = self.item_scope();
|
||||
def_map.module_id(local_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue