Suppress missing field error when autoderef bottoms out in infer
This commit is contained in:
parent
0c478fdfe1
commit
b8c4c163f0
3 changed files with 9 additions and 12 deletions
|
@ -2915,8 +2915,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
// We failed to check the expression, report an error.
|
||||
|
||||
// Emits an error if we deref an infer variable, like calling `.field` on a base type of &_.
|
||||
self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
|
||||
// Emits an error if we deref an infer variable, like calling `.field` on a base type
|
||||
// of `&_`. We can also use this to suppress unnecessary "missing field" errors that
|
||||
// will follow ambiguity errors.
|
||||
let final_ty = self.structurally_resolve_type(autoderef.span(), autoderef.final_ty(false));
|
||||
if let ty::Error(_) = final_ty.kind() {
|
||||
return final_ty;
|
||||
}
|
||||
|
||||
if let Some((adjustments, did)) = private_candidate {
|
||||
// (#90483) apply adjustments to avoid ExprUseVisitor from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue