diff options
author | Aleksey Kladov <[email protected]> | 2020-04-25 19:56:25 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-25 20:09:33 +0100 |
commit | 0f099ead8893fa9551e385b030a4239ea1338451 (patch) | |
tree | f9920ebf659c7589d6ad4c89aecb7f9d88f0161c /crates/ra_hir_ty/src | |
parent | 95b989ec3059eca140d9bfffee1bc52e30f9d17b (diff) |
Fix panic in NoSuchField diagnostic
Diffstat (limited to 'crates/ra_hir_ty/src')
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index 6a53be621..bd4ef69a0 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -667,7 +667,7 @@ impl Expectation { | |||
667 | } | 667 | } |
668 | 668 | ||
669 | mod diagnostics { | 669 | mod diagnostics { |
670 | use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup}; | 670 | use hir_def::{expr::ExprId, FunctionId}; |
671 | use hir_expand::diagnostics::DiagnosticSink; | 671 | use hir_expand::diagnostics::DiagnosticSink; |
672 | 672 | ||
673 | use crate::{db::HirDatabase, diagnostics::NoSuchField}; | 673 | use crate::{db::HirDatabase, diagnostics::NoSuchField}; |
@@ -686,10 +686,9 @@ mod diagnostics { | |||
686 | ) { | 686 | ) { |
687 | match self { | 687 | match self { |
688 | InferenceDiagnostic::NoSuchField { expr, field } => { | 688 | InferenceDiagnostic::NoSuchField { expr, field } => { |
689 | let source = owner.lookup(db.upcast()).source(db.upcast()); | ||
690 | let (_, source_map) = db.body_with_source_map(owner.into()); | 689 | let (_, source_map) = db.body_with_source_map(owner.into()); |
691 | let field = source_map.field_syntax(*expr, *field); | 690 | let field = source_map.field_syntax(*expr, *field); |
692 | sink.push(NoSuchField { file: source.file_id, field: field.value }) | 691 | sink.push(NoSuchField { file: field.file_id, field: field.value }) |
693 | } | 692 | } |
694 | } | 693 | } |
695 | } | 694 | } |