diff options
Diffstat (limited to 'crates/hir/src/semantics.rs')
-rw-r--r-- | crates/hir/src/semantics.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 59292d5a2..144851f83 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
@@ -16,13 +16,12 @@ use rustc_hash::{FxHashMap, FxHashSet}; | |||
16 | use syntax::{ | 16 | use syntax::{ |
17 | algo::find_node_at_offset, | 17 | algo::find_node_at_offset, |
18 | ast::{self, GenericParamsOwner, LoopBodyOwner}, | 18 | ast::{self, GenericParamsOwner, LoopBodyOwner}, |
19 | match_ast, AstNode, SyntaxNode, SyntaxToken, TextSize, | 19 | match_ast, AstNode, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextSize, |
20 | }; | 20 | }; |
21 | 21 | ||
22 | use crate::{ | 22 | use crate::{ |
23 | code_model::Access, | 23 | code_model::Access, |
24 | db::HirDatabase, | 24 | db::HirDatabase, |
25 | diagnostics::Diagnostic, | ||
26 | semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx}, | 25 | semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx}, |
27 | source_analyzer::{resolve_hir_path, SourceAnalyzer}, | 26 | source_analyzer::{resolve_hir_path, SourceAnalyzer}, |
28 | AssocItem, Callable, ConstParam, Crate, Field, Function, HirFileId, Impl, InFile, Label, | 27 | AssocItem, Callable, ConstParam, Crate, Field, Function, HirFileId, Impl, InFile, Label, |
@@ -141,7 +140,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
141 | self.imp.original_range(node) | 140 | self.imp.original_range(node) |
142 | } | 141 | } |
143 | 142 | ||
144 | pub fn diagnostics_display_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { | 143 | pub fn diagnostics_display_range(&self, diagnostics: InFile<SyntaxNodePtr>) -> FileRange { |
145 | self.imp.diagnostics_display_range(diagnostics) | 144 | self.imp.diagnostics_display_range(diagnostics) |
146 | } | 145 | } |
147 | 146 | ||
@@ -385,8 +384,7 @@ impl<'db> SemanticsImpl<'db> { | |||
385 | node.as_ref().original_file_range(self.db.upcast()) | 384 | node.as_ref().original_file_range(self.db.upcast()) |
386 | } | 385 | } |
387 | 386 | ||
388 | fn diagnostics_display_range(&self, diagnostics: &dyn Diagnostic) -> FileRange { | 387 | fn diagnostics_display_range(&self, src: InFile<SyntaxNodePtr>) -> FileRange { |
389 | let src = diagnostics.display_source(); | ||
390 | let root = self.db.parse_or_expand(src.file_id).unwrap(); | 388 | let root = self.db.parse_or_expand(src.file_id).unwrap(); |
391 | let node = src.value.to_node(&root); | 389 | let node = src.value.to_node(&root); |
392 | self.cache(root, src.file_id); | 390 | self.cache(root, src.file_id); |