Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
use crate::mir::ProjectionKind;
use crate::mir::interpret::ConstValue;
use crate::mir::ProjectionKind;
use crate::mir::interpret::ConstValue;
-use crate::ty::{self, Lift, Ty, TyCtxt};
+use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid, InferConst};
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use smallvec::SmallVec;
use crate::mir::interpret;
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use smallvec::SmallVec;
use crate::mir::interpret;
+use std::marker::PhantomData;
use std::rc::Rc;
///////////////////////////////////////////////////////////////////////////
use std::rc::Rc;
///////////////////////////////////////////////////////////////////////////
crate::ty::BoundRegion,
crate::ty::ClosureKind,
crate::ty::IntVarValue,
crate::ty::BoundRegion,
crate::ty::ClosureKind,
crate::ty::IntVarValue,
crate::ty::ParamTy,
crate::ty::UniverseIndex,
crate::ty::Variance,
crate::ty::ParamTy,
crate::ty::UniverseIndex,
crate::ty::Variance,
type Lifted = ConstValue<'tcx>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
match *self {
type Lifted = ConstValue<'tcx>;
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
match *self {
+ ConstValue::Param(param) => Some(ConstValue::Param(param)),
+ ConstValue::Infer(infer) => {
+ Some(ConstValue::Infer(match infer {
+ InferConst::Var(vid) => InferConst::Var(vid.lift_to_tcx(tcx)?),
+ InferConst::Fresh(i) => InferConst::Fresh(i),
+ InferConst::Canonical(debrujin, var) => InferConst::Canonical(debrujin, var),
+ }))
+ }
ConstValue::Scalar(x) => Some(ConstValue::Scalar(x)),
ConstValue::Slice(x, y) => Some(ConstValue::Slice(x, y)),
ConstValue::ByRef(ptr, alloc) => Some(ConstValue::ByRef(
ConstValue::Scalar(x) => Some(ConstValue::Scalar(x)),
ConstValue::Slice(x, y) => Some(ConstValue::Slice(x, y)),
ConstValue::ByRef(ptr, alloc) => Some(ConstValue::ByRef(
+impl<'a, 'tcx> Lift<'tcx> for ConstVid<'a> {
+ type Lifted = ConstVid<'tcx>;
+ fn lift_to_tcx<'b, 'gcx>(&self, _: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
+ Some(ConstVid {
+ index: self.index,
+ phantom: PhantomData,
+ })
+ }
+}
+
///////////////////////////////////////////////////////////////////////////
// TypeFoldable implementations.
//
///////////////////////////////////////////////////////////////////////////
// TypeFoldable implementations.
//