1
Fork 0

Reduce direct mk_ty usage.

We use more specific `mk_*` functions in most places, might as well use
them as much as possible.
This commit is contained in:
Nicholas Nethercote 2023-02-08 12:28:03 +11:00
parent 6248bbbf26
commit 7a72560154
25 changed files with 92 additions and 82 deletions

View file

@ -752,7 +752,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
self.fold_ty(bound_to)
} else {
let var = self.canonical_var(info, ty_var.into());
self.tcx().mk_ty(ty::Bound(self.binder_index, var.into()))
self.tcx().mk_bound(self.binder_index, var.into())
}
}

View file

@ -124,7 +124,7 @@ impl<'tcx> InferCtxt<'tcx> {
CanonicalVarKind::PlaceholderTy(ty::PlaceholderType { universe, name }) => {
let universe_mapped = universe_map(universe);
let placeholder_mapped = ty::PlaceholderType { universe: universe_mapped, name };
self.tcx.mk_ty(ty::Placeholder(placeholder_mapped)).into()
self.tcx.mk_placeholder(placeholder_mapped).into()
}
CanonicalVarKind::Region(ui) => self

View file

@ -88,10 +88,10 @@ impl<'tcx> InferCtxt<'tcx> {
}))
},
types: &mut |bound_ty: ty::BoundTy| {
self.tcx.mk_ty(ty::Placeholder(ty::PlaceholderType {
self.tcx.mk_placeholder(ty::PlaceholderType {
universe: next_universe,
name: bound_ty.kind,
}))
})
},
consts: &mut |bound_var: ty::BoundVar, ty| {
self.tcx

View file

@ -2071,14 +2071,14 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
if let ty::Infer(_) = t.kind() {
self.tcx.mk_ty(ty::Placeholder(ty::PlaceholderType {
self.tcx.mk_placeholder(ty::PlaceholderType {
universe: ty::UniverseIndex::ROOT,
name: ty::BoundTyKind::Anon({
let idx = self.idx;
self.idx += 1;
idx
}),
}))
})
} else {
t.super_fold_with(self)
}