]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_middle/src/ty/relate.rs
Use Term in ProjectionPredicate
[rust.git] / compiler / rustc_middle / src / ty / relate.rs
index 9e381cabdfe8482995ecdf1ed05dc4238b02f85f..851c4592f4fad8594e6fa4f85064bfb1ea9dba7f 100644 (file)
@@ -7,7 +7,7 @@
 use crate::mir::interpret::{get_slice_bytes, ConstValue, GlobalAlloc, Scalar};
 use crate::ty::error::{ExpectedFound, TypeError};
 use crate::ty::subst::{GenericArg, GenericArgKind, Subst, SubstsRef};
-use crate::ty::{self, Ty, TyCtxt, TypeFoldable};
+use crate::ty::{self, Term, Ty, TyCtxt, TypeFoldable};
 use rustc_hir as ast;
 use rustc_hir::def_id::DefId;
 use rustc_span::DUMMY_SP;
@@ -839,10 +839,13 @@ fn relate<R: TypeRelation<'tcx>>(
         a: ty::ProjectionPredicate<'tcx>,
         b: ty::ProjectionPredicate<'tcx>,
     ) -> RelateResult<'tcx, ty::ProjectionPredicate<'tcx>> {
-        Ok(ty::ProjectionPredicate {
-            projection_ty: relation.relate(a.projection_ty, b.projection_ty)?,
-            ty: relation.relate(a.ty, b.ty)?,
-        })
+        match (a.term, b.term) {
+            (Term::Ty(a_ty), Term::Ty(b_ty)) => Ok(ty::ProjectionPredicate {
+                projection_ty: relation.relate(a.projection_ty, b.projection_ty)?,
+                term: relation.relate(a_ty, b_ty)?.into(),
+            }),
+            _ => todo!(),
+        }
     }
 }