mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Don't show unresolved-field
diagnostic for missing names
This commit is contained in:
parent
e95644e279
commit
827a0530bc
3 changed files with 27 additions and 1 deletions
|
@ -1449,6 +1449,13 @@ impl InferenceContext<'_> {
|
|||
|
||||
fn infer_field_access(&mut self, tgt_expr: ExprId, receiver: ExprId, name: &Name) -> Ty {
|
||||
let receiver_ty = self.infer_expr_inner(receiver, &Expectation::none());
|
||||
|
||||
if name.is_missing() {
|
||||
// Bail out early, don't even try to look up field. Also, we don't issue an unresolved
|
||||
// field diagnostic because this is a syntax error rather than a semantic error.
|
||||
return self.err_ty();
|
||||
}
|
||||
|
||||
match self.lookup_field(&receiver_ty, name) {
|
||||
Some((ty, field_id, adjustments, is_public)) => {
|
||||
self.write_expr_adj(receiver, adjustments);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue