Replace mk_const with Const::new_x methods

This commit is contained in:
Boxy 2023-07-04 14:26:19 +01:00
parent cd68ead9ec
commit ddbc774e74
32 changed files with 219 additions and 134 deletions

View file

@ -386,11 +386,10 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
.type_of(param.def_id)
.no_bound_vars()
.expect("ct params cannot have early bound vars");
tcx.mk_const(
ty::ConstKind::Bound(
ty::INNERMOST,
ty::BoundVar::from_usize(num_bound_vars),
),
ty::Const::new_bound(
tcx,
ty::INNERMOST,
ty::BoundVar::from_usize(num_bound_vars),
ty,
)
.into()

View file

@ -1970,7 +1970,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
assert!(!ct.ty().has_escaping_bound_vars());
match ct.kind() {
ty::ConstKind::Bound(_, bv) => self.tcx.mk_const(
ty::ConstKind::Bound(_, bv) => ty::Const::new_placeholder(
self.tcx,
ty::PlaceholderConst { universe: self.universe, bound: bv },
ct.ty(),
),

View file

@ -2047,11 +2047,10 @@ pub(super) fn check_type_bounds<'tcx>(
GenericParamDefKind::Const { .. } => {
let bound_var = ty::BoundVariableKind::Const;
bound_vars.push(bound_var);
tcx.mk_const(
ty::ConstKind::Bound(
ty::INNERMOST,
ty::BoundVar::from_usize(bound_vars.len() - 1),
),
ty::Const::new_bound(
tcx,
ty::INNERMOST,
ty::BoundVar::from_usize(bound_vars.len() - 1),
tcx.type_of(param.def_id)
.no_bound_vars()
.expect("const parameter types cannot be generic"),

View file

@ -243,9 +243,12 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
let name = param.name.ident().name;
let param_const = ty::ParamConst::new(index, name);
let ct_ty = tcx.type_of(param.def_id.to_def_id()).subst_identity();
let ct_ty = tcx
.type_of(param.def_id.to_def_id())
.no_bound_vars()
.expect("const parameters cannot be generic");
let ct = tcx.mk_const(param_const, ct_ty);
let ct = ty::Const::new_param(tcx, param_const, ct_ty);
predicates.insert((
ty::ClauseKind::ConstArgHasType(ct, ct_ty).to_predicate(tcx),