diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-08 12:28:03 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-13 09:32:48 +1100 |
| commit | 7a7256015411f3178df466438006fe45530f4109 (patch) | |
| tree | ffd106d4018c6af3dce117fb13ad7f31ba677944 /compiler/rustc_middle/src/ty/fold.rs | |
| parent | 6248bbbf268c327d70967bc7dcab909f912b9bf8 (diff) | |
| download | rust-7a7256015411f3178df466438006fe45530f4109.tar.gz rust-7a7256015411f3178df466438006fe45530f4109.zip | |
Reduce direct `mk_ty` usage.
We use more specific `mk_*` functions in most places, might as well use them as much as possible.
Diffstat (limited to 'compiler/rustc_middle/src/ty/fold.rs')
| -rw-r--r-- | compiler/rustc_middle/src/ty/fold.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_middle/src/ty/fold.rs b/compiler/rustc_middle/src/ty/fold.rs index 8a0019bc012..c0d319edf76 100644 --- a/compiler/rustc_middle/src/ty/fold.rs +++ b/compiler/rustc_middle/src/ty/fold.rs @@ -562,10 +562,7 @@ impl<'tcx> TyCtxt<'tcx> { )) }, types: &mut |t: ty::BoundTy| { - self.mk_ty(ty::Bound( - ty::INNERMOST, - ty::BoundTy { var: shift_bv(t.var), kind: t.kind }, - )) + self.mk_bound(ty::INNERMOST, ty::BoundTy { var: shift_bv(t.var), kind: t.kind }) }, consts: &mut |c, ty: Ty<'tcx>| { self.mk_const(ty::ConstKind::Bound(ty::INNERMOST, shift_bv(c)), ty) @@ -614,7 +611,7 @@ impl<'tcx> TyCtxt<'tcx> { ty::BoundVariableKind::Ty(ty::BoundTyKind::Anon(index as u32)) }) .expect_ty(); - self.tcx.mk_ty(ty::Bound(ty::INNERMOST, BoundTy { var, kind })) + self.tcx.mk_bound(ty::INNERMOST, BoundTy { var, kind }) } fn replace_const(&mut self, bv: ty::BoundVar, ty: Ty<'tcx>) -> ty::Const<'tcx> { let entry = self.map.entry(bv); @@ -684,7 +681,7 @@ impl<'tcx> TypeFolder<'tcx> for Shifter<'tcx> { match *ty.kind() { ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => { let debruijn = debruijn.shifted_in(self.amount); - self.tcx.mk_ty(ty::Bound(debruijn, bound_ty)) + self.tcx.mk_bound(debruijn, bound_ty) } _ if ty.has_vars_bound_at_or_above(self.current_index) => ty.super_fold_with(self), |
