X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fty%2Frelate.rs;h=851c4592f4fad8594e6fa4f85064bfb1ea9dba7f;hb=67f56671d0384bdb2d92dddebfbf42510b16e0f7;hp=63ed318cadb890932a851bcec4bb75a7966e3a65;hpb=8dc3bf7221d69e4fbfb847ed209c39aae3f6c7a9;p=rust.git diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 63ed318cadb..851c4592f4f 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -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; @@ -599,13 +599,13 @@ pub fn super_relate_consts<'tcx, R: TypeRelation<'tcx>>( let substs = relation.relate_with_variance( ty::Variance::Invariant, ty::VarianceDiagInfo::default(), - au.substs(tcx), - bu.substs(tcx), + au.substs, + bu.substs, )?; return Ok(tcx.mk_const(ty::Const { val: ty::ConstKind::Unevaluated(ty::Unevaluated { def: au.def, - substs_: Some(substs), + substs, promoted: au.promoted, }), ty: a.ty, @@ -839,10 +839,13 @@ fn relate>( 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!(), + } } }