diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/semantics.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 6a49c424a..810c49d6f 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -297,19 +297,19 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
297 | self.with_ctx(|ctx| ctx.file_to_def(file)).map(Module::from) | 297 | self.with_ctx(|ctx| ctx.file_to_def(file)).map(Module::from) |
298 | } | 298 | } |
299 | 299 | ||
300 | pub fn scope(&self, node: &SyntaxNode) -> SemanticsScope<'db, DB> { | 300 | pub fn scope(&self, node: &SyntaxNode) -> SemanticsScope<'db> { |
301 | let node = self.find_file(node.clone()); | 301 | let node = self.find_file(node.clone()); |
302 | let resolver = self.analyze2(node.as_ref(), None).resolver; | 302 | let resolver = self.analyze2(node.as_ref(), None).resolver; |
303 | SemanticsScope { db: self.db, resolver } | 303 | SemanticsScope { db: self.db, resolver } |
304 | } | 304 | } |
305 | 305 | ||
306 | pub fn scope_at_offset(&self, node: &SyntaxNode, offset: TextSize) -> SemanticsScope<'db, DB> { | 306 | pub fn scope_at_offset(&self, node: &SyntaxNode, offset: TextSize) -> SemanticsScope<'db> { |
307 | let node = self.find_file(node.clone()); | 307 | let node = self.find_file(node.clone()); |
308 | let resolver = self.analyze2(node.as_ref(), Some(offset)).resolver; | 308 | let resolver = self.analyze2(node.as_ref(), Some(offset)).resolver; |
309 | SemanticsScope { db: self.db, resolver } | 309 | SemanticsScope { db: self.db, resolver } |
310 | } | 310 | } |
311 | 311 | ||
312 | pub fn scope_for_def(&self, def: Trait) -> SemanticsScope<'db, DB> { | 312 | pub fn scope_for_def(&self, def: Trait) -> SemanticsScope<'db> { |
313 | let resolver = def.id.resolver(self.db); | 313 | let resolver = def.id.resolver(self.db); |
314 | SemanticsScope { db: self.db, resolver } | 314 | SemanticsScope { db: self.db, resolver } |
315 | } | 315 | } |
@@ -419,12 +419,12 @@ fn find_root(node: &SyntaxNode) -> SyntaxNode { | |||
419 | node.ancestors().last().unwrap() | 419 | node.ancestors().last().unwrap() |
420 | } | 420 | } |
421 | 421 | ||
422 | pub struct SemanticsScope<'a, DB> { | 422 | pub struct SemanticsScope<'a> { |
423 | pub db: &'a DB, | 423 | pub db: &'a dyn HirDatabase, |
424 | resolver: Resolver, | 424 | resolver: Resolver, |
425 | } | 425 | } |
426 | 426 | ||
427 | impl<'a, DB: HirDatabase> SemanticsScope<'a, DB> { | 427 | impl<'a> SemanticsScope<'a> { |
428 | pub fn module(&self) -> Option<Module> { | 428 | pub fn module(&self) -> Option<Module> { |
429 | Some(Module { id: self.resolver.module()? }) | 429 | Some(Module { id: self.resolver.module()? }) |
430 | } | 430 | } |
@@ -433,13 +433,13 @@ impl<'a, DB: HirDatabase> SemanticsScope<'a, DB> { | |||
433 | // FIXME: rename to visible_traits to not repeat scope? | 433 | // FIXME: rename to visible_traits to not repeat scope? |
434 | pub fn traits_in_scope(&self) -> FxHashSet<TraitId> { | 434 | pub fn traits_in_scope(&self) -> FxHashSet<TraitId> { |
435 | let resolver = &self.resolver; | 435 | let resolver = &self.resolver; |
436 | resolver.traits_in_scope(self.db) | 436 | resolver.traits_in_scope(self.db.upcast()) |
437 | } | 437 | } |
438 | 438 | ||
439 | pub fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef)) { | 439 | pub fn process_all_names(&self, f: &mut dyn FnMut(Name, ScopeDef)) { |
440 | let resolver = &self.resolver; | 440 | let resolver = &self.resolver; |
441 | 441 | ||
442 | resolver.process_all_names(self.db, &mut |name, def| { | 442 | resolver.process_all_names(self.db.upcast(), &mut |name, def| { |
443 | let def = match def { | 443 | let def = match def { |
444 | resolver::ScopeDef::PerNs(it) => { | 444 | resolver::ScopeDef::PerNs(it) => { |
445 | let items = ScopeDef::all_items(it); | 445 | let items = ScopeDef::all_items(it); |