mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Fix panic in NoSuchField diagnostic
This commit is contained in:
parent
95b989ec30
commit
0f099ead88
1 changed files with 2 additions and 3 deletions
|
@ -667,7 +667,7 @@ impl Expectation {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod diagnostics {
|
mod diagnostics {
|
||||||
use hir_def::{expr::ExprId, src::HasSource, FunctionId, Lookup};
|
use hir_def::{expr::ExprId, FunctionId};
|
||||||
use hir_expand::diagnostics::DiagnosticSink;
|
use hir_expand::diagnostics::DiagnosticSink;
|
||||||
|
|
||||||
use crate::{db::HirDatabase, diagnostics::NoSuchField};
|
use crate::{db::HirDatabase, diagnostics::NoSuchField};
|
||||||
|
@ -686,10 +686,9 @@ mod diagnostics {
|
||||||
) {
|
) {
|
||||||
match self {
|
match self {
|
||||||
InferenceDiagnostic::NoSuchField { expr, field } => {
|
InferenceDiagnostic::NoSuchField { expr, field } => {
|
||||||
let source = owner.lookup(db.upcast()).source(db.upcast());
|
|
||||||
let (_, source_map) = db.body_with_source_map(owner.into());
|
let (_, source_map) = db.body_with_source_map(owner.into());
|
||||||
let field = source_map.field_syntax(*expr, *field);
|
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 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue