use crate::hir::def::Namespace;
use crate::mir::ProjectionKind;
use crate::mir::interpret::ConstValue;
-use crate::ty::{self, Lift, Ty, TyCtxt, ConstVid, InferConst};
+use crate::ty::{self, Lift, Ty, TyCtxt, InferConst};
use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use crate::ty::print::{FmtPrinter, Printer};
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use crate::mir::interpret;
use std::fmt;
-use std::marker::PhantomData;
use std::rc::Rc;
impl fmt::Debug for ty::GenericParamDef {
(),
bool,
usize,
- u32,
- crate::ty::BoundVar,
- crate::ty::DebruijnIndex,
crate::ty::layout::VariantIdx,
u64,
String,
::rustc_target::spec::abi::Abi,
crate::mir::Local,
crate::mir::Promoted,
- crate::mir::interpret::Scalar,
- crate::mir::interpret::Pointer,
crate::traits::Reveal,
crate::ty::adjustment::AutoBorrowMutability,
crate::ty::AdtKind,
}
}
-BraceStructLiftImpl! {
- impl<'a, 'tcx> Lift<'tcx> for ty::Const<'a> {
- type Lifted = ty::Const<'tcx>;
- val, ty
- }
-}
-
-EnumLiftImpl! {
- impl<'a, 'tcx> Lift<'tcx> for interpret::ConstValue<'a> {
- type Lifted = interpret::ConstValue<'tcx>;
- (interpret::ConstValue::Unevaluated)(a, b),
- (interpret::ConstValue::Param)(a),
- (interpret::ConstValue::Infer)(a),
- (interpret::ConstValue::Scalar)(a),
- (interpret::ConstValue::Slice)(a, b),
- (interpret::ConstValue::ByRef)(a, b),
- }
-}
-
-EnumLiftImpl! {
- impl<'a, 'tcx> Lift<'tcx> for ty::InferConst<'a> {
- type Lifted = ty::InferConst<'tcx>;
- (ty::InferConst::Var)(a),
- (ty::InferConst::Fresh)(a),
- (ty::InferConst::Canonical)(a, b),
- }
-}
-
-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.
//
ConstValue::Param(p) => ConstValue::Param(p.fold_with(folder)),
ConstValue::Placeholder(p) => ConstValue::Placeholder(p),
ConstValue::Scalar(a) => ConstValue::Scalar(a),
- ConstValue::Slice(a, b) => ConstValue::Slice(a, b),
+ ConstValue::Slice { data, start, end } => ConstValue::Slice { data, start, end },
ConstValue::Unevaluated(did, substs)
=> ConstValue::Unevaluated(did, substs.fold_with(folder)),
}
ConstValue::Param(p) => p.visit_with(visitor),
ConstValue::Placeholder(_) => false,
ConstValue::Scalar(_) => false,
- ConstValue::Slice(..) => false,
+ ConstValue::Slice { .. } => false,
ConstValue::Unevaluated(_, substs) => substs.visit_with(visitor),
}
}