about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-13 07:09:08 +0000
committerMichael Goulet <michael@errs.io>2022-08-14 20:22:10 +0000
commit16b33cc1e32d1814d961d97a6e76defc079316d2 (patch)
tree6a7e3738d24c857101712321aba8f5dbcacc0117 /compiler
parent801821d1560f84e4716fcbd9244ec959320a13d5 (diff)
downloadrust-16b33cc1e32d1814d961d97a6e76defc079316d2.tar.gz
rust-16b33cc1e32d1814d961d97a6e76defc079316d2.zip
Point to argument if it's self type of unsatisfied projection predicate
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_typeck/src/check/fn_ctxt/checks.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
index a7df5320296..1f2dfc30ae0 100644
--- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
+++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs
@@ -1660,12 +1660,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     ObligationCauseCode::ImplDerivedObligation(code) => {
                         code.derived.parent_trait_pred.self_ty().skip_binder().into()
                     }
-                    _ if let ty::PredicateKind::Trait(predicate) =
-                        error.obligation.predicate.kind().skip_binder() =>
-                    {
-                        predicate.self_ty().into()
-                    }
-                    _ => continue,
+                    _ => match error.obligation.predicate.kind().skip_binder() {
+                        ty::PredicateKind::Trait(predicate) => predicate.self_ty().into(),
+                        ty::PredicateKind::Projection(predicate) => {
+                            predicate.projection_ty.self_ty().into()
+                        }
+                        _ => continue,
+                    },
                 };
             let self_ = self.resolve_vars_if_possible(self_);
             let ty_matches_self = |ty: Ty<'tcx>| ty.walk().any(|arg| arg == self_);