Remove tcx.mk_const_var
... `tcx.mk_const` can now be used instead
This commit is contained in:
parent
e20e506f7d
commit
7087d9b2a0
5 changed files with 15 additions and 27 deletions
|
@ -753,7 +753,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
||||||
origin: var_value.origin,
|
origin: var_value.origin,
|
||||||
val: ConstVariableValue::Unknown { universe: self.for_universe },
|
val: ConstVariableValue::Unknown { universe: self.for_universe },
|
||||||
});
|
});
|
||||||
Ok(self.tcx().mk_const_var(new_var_id, c.ty()))
|
Ok(self.tcx().mk_const(new_var_id, c.ty()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Ok(self.tcx().mk_const_var(new_var_id, c.ty()))
|
Ok(self.tcx().mk_const(new_var_id, c.ty()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
|
||||||
Entry::Vacant(entry) => {
|
Entry::Vacant(entry) => {
|
||||||
let index = self.const_freshen_count;
|
let index = self.const_freshen_count;
|
||||||
self.const_freshen_count += 1;
|
self.const_freshen_count += 1;
|
||||||
let ct = self.infcx.tcx.mk_const_infer(freshener(index), ty);
|
let ct = self.infcx.tcx.mk_const(freshener(index), ty);
|
||||||
entry.insert(ct);
|
entry.insert(ct);
|
||||||
ct
|
ct
|
||||||
}
|
}
|
||||||
|
|
|
@ -1065,7 +1065,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_const_var(&self, ty: Ty<'tcx>, origin: ConstVariableOrigin) -> ty::Const<'tcx> {
|
pub fn next_const_var(&self, ty: Ty<'tcx>, origin: ConstVariableOrigin) -> ty::Const<'tcx> {
|
||||||
self.tcx.mk_const_var(self.next_const_var_id(origin), ty)
|
self.tcx.mk_const(self.next_const_var_id(origin), ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_const_var_in_universe(
|
pub fn next_const_var_in_universe(
|
||||||
|
@ -1079,7 +1079,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.const_unification_table()
|
.const_unification_table()
|
||||||
.new_key(ConstVarValue { origin, val: ConstVariableValue::Unknown { universe } });
|
.new_key(ConstVarValue { origin, val: ConstVariableValue::Unknown { universe } });
|
||||||
self.tcx.mk_const_var(vid, ty)
|
self.tcx.mk_const(vid, ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn next_const_var_id(&self, origin: ConstVariableOrigin) -> ConstVid<'tcx> {
|
pub fn next_const_var_id(&self, origin: ConstVariableOrigin) -> ConstVid<'tcx> {
|
||||||
|
@ -1195,7 +1195,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
||||||
origin,
|
origin,
|
||||||
val: ConstVariableValue::Unknown { universe: self.universe() },
|
val: ConstVariableValue::Unknown { universe: self.universe() },
|
||||||
});
|
});
|
||||||
self.tcx.mk_const_var(const_var_id, self.tcx.type_of(param.def_id)).into()
|
self.tcx.mk_const(const_var_id, self.tcx.type_of(param.def_id)).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ where
|
||||||
origin: var_value.origin,
|
origin: var_value.origin,
|
||||||
val: ConstVariableValue::Unknown { universe: self.universe },
|
val: ConstVariableValue::Unknown { universe: self.universe },
|
||||||
});
|
});
|
||||||
Ok(self.tcx().mk_const_var(new_var_id, a.ty()))
|
Ok(self.tcx().mk_const(new_var_id, a.ty()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ use crate::traits;
|
||||||
use crate::ty::query::{self, TyCtxtAt};
|
use crate::ty::query::{self, TyCtxtAt};
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig,
|
self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig,
|
||||||
ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, FloatTy, FloatVar, FloatVid,
|
ClosureSizeProfileData, Const, ConstS, DefIdTree, FloatTy, FloatVar, FloatVid,
|
||||||
GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid, List, ParamConst, ParamTy,
|
GenericParamDefKind, InferTy, IntTy, IntVar, IntVid, List, ParamConst, ParamTy,
|
||||||
PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy,
|
PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy,
|
||||||
Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut,
|
Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut,
|
||||||
UintTy, Visibility,
|
UintTy, Visibility,
|
||||||
|
@ -2602,11 +2602,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self.mk_const_internal(ty::ConstS { kind: kind.into(), ty })
|
self.mk_const_internal(ty::ConstS { kind: kind.into(), ty })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn mk_const_var(self, v: ConstVid<'tcx>, ty: Ty<'tcx>) -> Const<'tcx> {
|
|
||||||
self.mk_const(ty::ConstKind::Infer(InferConst::Var(v)), ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mk_int_var(self, v: IntVid) -> Ty<'tcx> {
|
pub fn mk_int_var(self, v: IntVid) -> Ty<'tcx> {
|
||||||
self.mk_ty_infer(IntVar(v))
|
self.mk_ty_infer(IntVar(v))
|
||||||
|
@ -2622,30 +2617,23 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
self.mk_ty(Infer(it))
|
self.mk_ty(Infer(it))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn mk_const_infer(self, ic: InferConst<'tcx>, ty: Ty<'tcx>) -> ty::Const<'tcx> {
|
|
||||||
self.mk_const(ty::ConstKind::Infer(ic), ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mk_ty_param(self, index: u32, name: Symbol) -> Ty<'tcx> {
|
pub fn mk_ty_param(self, index: u32, name: Symbol) -> Ty<'tcx> {
|
||||||
self.mk_ty(Param(ParamTy { index, name }))
|
self.mk_ty(Param(ParamTy { index, name }))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn mk_const_param(self, index: u32, name: Symbol, ty: Ty<'tcx>) -> Const<'tcx> {
|
|
||||||
self.mk_const(ty::ConstKind::Param(ParamConst { index, name }), ty)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
|
pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
|
||||||
match param.kind {
|
match param.kind {
|
||||||
GenericParamDefKind::Lifetime => {
|
GenericParamDefKind::Lifetime => {
|
||||||
self.mk_region(ty::ReEarlyBound(param.to_early_bound_region_data())).into()
|
self.mk_region(ty::ReEarlyBound(param.to_early_bound_region_data())).into()
|
||||||
}
|
}
|
||||||
GenericParamDefKind::Type { .. } => self.mk_ty_param(param.index, param.name).into(),
|
GenericParamDefKind::Type { .. } => self.mk_ty_param(param.index, param.name).into(),
|
||||||
GenericParamDefKind::Const { .. } => {
|
GenericParamDefKind::Const { .. } => self
|
||||||
self.mk_const_param(param.index, param.name, self.type_of(param.def_id)).into()
|
.mk_const(
|
||||||
}
|
ParamConst { index: param.index, name: param.name },
|
||||||
|
self.type_of(param.def_id),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue