]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/wfcheck.rs
Rollup merge of #58931 - estebank:elide-receiver-tyerr, r=varkor
[rust.git] / src / librustc_typeck / check / wfcheck.rs
index 16cf25f0d4916e183e05384571dcba7063adc075..388e8282ee3a3aaa5db328983e6f3697b7eab02b 100644 (file)
@@ -881,7 +881,9 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>(
         } else {
             debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`",
                 receiver_ty, self_ty);
-            return false
+            // If he receiver already has errors reported due to it, consider it valid to avoid
+            // unecessary errors (#58712).
+            return receiver_ty.references_error();
         }
 
         // without the `arbitrary_self_types` feature, `receiver_ty` must directly deref to