Skip to content

Commit 7087d9b

Browse files
committedNov 28, 2022
Remove tcx.mk_const_var
... `tcx.mk_const` can now be used instead
1 parent e20e506 commit 7087d9b

File tree

5 files changed

+15
-27
lines changed

5 files changed

+15
-27
lines changed
 

‎compiler/rustc_infer/src/infer/combine.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
753753
origin: var_value.origin,
754754
val: ConstVariableValue::Unknown { universe: self.for_universe },
755755
});
756-
Ok(self.tcx().mk_const_var(new_var_id, c.ty()))
756+
Ok(self.tcx().mk_const(new_var_id, c.ty()))
757757
}
758758
}
759759
}
@@ -975,7 +975,7 @@ impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> {
975975
},
976976
},
977977
);
978-
Ok(self.tcx().mk_const_var(new_var_id, c.ty()))
978+
Ok(self.tcx().mk_const(new_var_id, c.ty()))
979979
}
980980
}
981981
}

‎compiler/rustc_infer/src/infer/freshen.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
102102
Entry::Vacant(entry) => {
103103
let index = self.const_freshen_count;
104104
self.const_freshen_count += 1;
105-
let ct = self.infcx.tcx.mk_const_infer(freshener(index), ty);
105+
let ct = self.infcx.tcx.mk_const(freshener(index), ty);
106106
entry.insert(ct);
107107
ct
108108
}

‎compiler/rustc_infer/src/infer/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ impl<'tcx> InferCtxt<'tcx> {
10651065
}
10661066

10671067
pub fn next_const_var(&self, ty: Ty<'tcx>, origin: ConstVariableOrigin) -> ty::Const<'tcx> {
1068-
self.tcx.mk_const_var(self.next_const_var_id(origin), ty)
1068+
self.tcx.mk_const(self.next_const_var_id(origin), ty)
10691069
}
10701070

10711071
pub fn next_const_var_in_universe(
@@ -1079,7 +1079,7 @@ impl<'tcx> InferCtxt<'tcx> {
10791079
.borrow_mut()
10801080
.const_unification_table()
10811081
.new_key(ConstVarValue { origin, val: ConstVariableValue::Unknown { universe } });
1082-
self.tcx.mk_const_var(vid, ty)
1082+
self.tcx.mk_const(vid, ty)
10831083
}
10841084

10851085
pub fn next_const_var_id(&self, origin: ConstVariableOrigin) -> ConstVid<'tcx> {
@@ -1195,7 +1195,7 @@ impl<'tcx> InferCtxt<'tcx> {
11951195
origin,
11961196
val: ConstVariableValue::Unknown { universe: self.universe() },
11971197
});
1198-
self.tcx.mk_const_var(const_var_id, self.tcx.type_of(param.def_id)).into()
1198+
self.tcx.mk_const(const_var_id, self.tcx.type_of(param.def_id)).into()
11991199
}
12001200
}
12011201
}

‎compiler/rustc_infer/src/infer/nll_relate/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ where
10871087
origin: var_value.origin,
10881088
val: ConstVariableValue::Unknown { universe: self.universe },
10891089
});
1090-
Ok(self.tcx().mk_const_var(new_var_id, a.ty()))
1090+
Ok(self.tcx().mk_const(new_var_id, a.ty()))
10911091
}
10921092
}
10931093
}

‎compiler/rustc_middle/src/ty/context.rs

+8-20
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use crate::traits;
1717
use crate::ty::query::{self, TyCtxtAt};
1818
use crate::ty::{
1919
self, AdtDef, AdtDefData, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig,
20-
ClosureSizeProfileData, Const, ConstS, ConstVid, DefIdTree, FloatTy, FloatVar, FloatVid,
21-
GenericParamDefKind, InferConst, InferTy, IntTy, IntVar, IntVid, List, ParamConst, ParamTy,
20+
ClosureSizeProfileData, Const, ConstS, DefIdTree, FloatTy, FloatVar, FloatVid,
21+
GenericParamDefKind, InferTy, IntTy, IntVar, IntVid, List, ParamConst, ParamTy,
2222
PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, PredicateS, ProjectionTy,
2323
Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut,
2424
UintTy, Visibility,
@@ -2602,11 +2602,6 @@ impl<'tcx> TyCtxt<'tcx> {
26022602
self.mk_const_internal(ty::ConstS { kind: kind.into(), ty })
26032603
}
26042604

2605-
#[inline]
2606-
pub fn mk_const_var(self, v: ConstVid<'tcx>, ty: Ty<'tcx>) -> Const<'tcx> {
2607-
self.mk_const(ty::ConstKind::Infer(InferConst::Var(v)), ty)
2608-
}
2609-
26102605
#[inline]
26112606
pub fn mk_int_var(self, v: IntVid) -> Ty<'tcx> {
26122607
self.mk_ty_infer(IntVar(v))
@@ -2622,30 +2617,23 @@ impl<'tcx> TyCtxt<'tcx> {
26222617
self.mk_ty(Infer(it))
26232618
}
26242619

2625-
#[inline]
2626-
pub fn mk_const_infer(self, ic: InferConst<'tcx>, ty: Ty<'tcx>) -> ty::Const<'tcx> {
2627-
self.mk_const(ty::ConstKind::Infer(ic), ty)
2628-
}
2629-
26302620
#[inline]
26312621
pub fn mk_ty_param(self, index: u32, name: Symbol) -> Ty<'tcx> {
26322622
self.mk_ty(Param(ParamTy { index, name }))
26332623
}
26342624

2635-
#[inline]
2636-
pub fn mk_const_param(self, index: u32, name: Symbol, ty: Ty<'tcx>) -> Const<'tcx> {
2637-
self.mk_const(ty::ConstKind::Param(ParamConst { index, name }), ty)
2638-
}
2639-
26402625
pub fn mk_param_from_def(self, param: &ty::GenericParamDef) -> GenericArg<'tcx> {
26412626
match param.kind {
26422627
GenericParamDefKind::Lifetime => {
26432628
self.mk_region(ty::ReEarlyBound(param.to_early_bound_region_data())).into()
26442629
}
26452630
GenericParamDefKind::Type { .. } => self.mk_ty_param(param.index, param.name).into(),
2646-
GenericParamDefKind::Const { .. } => {
2647-
self.mk_const_param(param.index, param.name, self.type_of(param.def_id)).into()
2648-
}
2631+
GenericParamDefKind::Const { .. } => self
2632+
.mk_const(
2633+
ParamConst { index: param.index, name: param.name },
2634+
self.type_of(param.def_id),
2635+
)
2636+
.into(),
26492637
}
26502638
}
26512639

0 commit comments

Comments
 (0)
Please sign in to comment.