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

@ -3572,7 +3572,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
{
type_diffs = vec![
Sorts(ty::error::ExpectedFound {
expected: self.tcx.mk_ty(ty::Alias(ty::Projection, where_pred.skip_binder().projection_ty)),
expected: self.tcx.mk_alias(ty::Projection, where_pred.skip_binder().projection_ty),
found,
}),
];

View file

@ -785,7 +785,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
let universe = self.universe_for(debruijn);
let p = ty::PlaceholderType { universe, name: bound_ty.kind };
self.mapped_types.insert(p, bound_ty);
self.infcx.tcx.mk_ty(ty::Placeholder(p))
self.infcx.tcx.mk_placeholder(p)
}
_ if t.has_vars_bound_at_or_above(self.current_index) => t.super_fold_with(self),
_ => t,
@ -915,7 +915,7 @@ impl<'tcx> TypeFolder<'tcx> for PlaceholderReplacer<'_, 'tcx> {
let db = ty::DebruijnIndex::from_usize(
self.universe_indices.len() - index + self.current_index.as_usize() - 1,
);
self.tcx().mk_ty(ty::Bound(db, *replace_var))
self.tcx().mk_bound(db, *replace_var)
}
None => ty,
}

View file

@ -527,13 +527,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let kind = ty::BoundTyKind::Param(param.def_id, param.name);
let bound_var = ty::BoundVariableKind::Ty(kind);
bound_vars.push(bound_var);
tcx.mk_ty(ty::Bound(
tcx.mk_bound(
ty::INNERMOST,
ty::BoundTy {
var: ty::BoundVar::from_usize(bound_vars.len() - 1),
kind,
},
))
)
.into()
}
GenericParamDefKind::Lifetime => {