]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_infer/src/traits/util.rs
Rollup merge of #107348 - lcnr:project-solve-new, r=compiler-errors
[rust.git] / compiler / rustc_infer / src / traits / util.rs
index 4ada7b22d084c3891b3ffacf89d8e2eb53fa763c..cd5bde2a791309c6c0f6d5aa6d73a55e412e0e36 100644 (file)
@@ -261,14 +261,15 @@ fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
 
                             Component::UnresolvedInferenceVariable(_) => None,
 
-                            Component::Alias(kind, data) => {
-                                let ty = tcx.mk_ty(ty::Alias(kind, data));
+                            Component::Alias(alias_ty) => {
+                                // We might end up here if we have `Foo<<Bar as Baz>::Assoc>: 'a`.
+                                // With this, we can deduce that `<Bar as Baz>::Assoc: 'a`.
                                 Some(ty::PredicateKind::Clause(ty::Clause::TypeOutlives(
-                                    ty::OutlivesPredicate(ty, r_min),
+                                    ty::OutlivesPredicate(alias_ty.to_ty(tcx), r_min),
                                 )))
                             }
 
-                            Component::EscapingProjection(_) => {
+                            Component::EscapingAlias(_) => {
                                 // We might be able to do more here, but we don't
                                 // want to deal with escaping vars right now.
                                 None