From 0f099ead8893fa9551e385b030a4239ea1338451 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Apr 2020 20:56:25 +0200 Subject: Fix panic in NoSuchField diagnostic --- crates/ra_hir_ty/src/infer.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates') 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 { } mod diagnostics { - use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup}; + use hir_def::{expr::ExprId, FunctionId}; use hir_expand::diagnostics::DiagnosticSink; use crate::{db::HirDatabase, diagnostics::NoSuchField}; @@ -686,10 +686,9 @@ mod diagnostics { ) { match self { InferenceDiagnostic::NoSuchField { expr, field } => { - let source = owner.lookup(db.upcast()).source(db.upcast()); let (_, source_map) = db.body_with_source_map(owner.into()); let field = source_map.field_syntax(*expr, *field); - sink.push(NoSuchField { file: source.file_id, field: field.value }) + sink.push(NoSuchField { file: field.file_id, field: field.value }) } } } -- cgit v1.2.3