]> git.lizzy.rs Git - rust.git/commitdiff
Fix panic in NoSuchField diagnostic
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 25 Apr 2020 18:56:25 +0000 (20:56 +0200)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 25 Apr 2020 19:09:33 +0000 (21:09 +0200)
crates/ra_hir_ty/src/infer.rs

index 6a53be621d2752cf803d4f63e2a80e6bdf69f3bc..bd4ef69a079a252c3fc3caf35f1af7a46367006f 100644 (file)
@@ -667,7 +667,7 @@ fn coercion_target(&self) -> &Ty {
 }
 
 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 @@ pub(super) fn add_to(
         ) {
             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 })
                 }
             }
         }