diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-05-02 19:42:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-02 19:42:50 +0200 |
| commit | d6940fb43d7c81d1b4e8fd2e3f699f3b43f0cc1a (patch) | |
| tree | 2023c261c6465bc512bead13c23cd20792797501 /compiler/rustc_middle/src | |
| parent | fe62bc5ea5302155558b053fee3d9aa6ed6fcad8 (diff) | |
| parent | 1c9a61d2111c93407018c99e15ddd78ea18a234e (diff) | |
Rollup merge of #124624 - WaffleLapkin:old_unit, r=fmease
Use `tcx.types.unit` instead of `Ty::new_unit(tcx)` I don't think there is any need for the function, given that we can just access the `.types`, similarly to all other primitives?
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/layout.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 5 |
2 files changed, 2 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index 189b95becfb..f8490e5e15f 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -125,7 +125,7 @@ impl Primitive { F64 => tcx.types.f64, F128 => tcx.types.f128, // FIXME(erikdesjardins): handle non-default addrspace ptr sizes - Pointer(_) => Ty::new_mut_ptr(tcx, Ty::new_unit(tcx)), + Pointer(_) => Ty::new_mut_ptr(tcx, tcx.types.unit), } } @@ -775,7 +775,7 @@ where // (which may have no non-DST form), and will work as long // as the `Abi` or `FieldsShape` is checked by users. if i == 0 { - let nil = Ty::new_unit(tcx); + let nil = tcx.types.unit; let unit_ptr_ty = if this.ty.is_unsafe_ptr() { Ty::new_mut_ptr(tcx, nil) } else { diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index d9350f36d33..de70c4f7b65 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1751,11 +1751,6 @@ impl<'tcx> Ty<'tcx> { // misc #[inline] - pub fn new_unit(tcx: TyCtxt<'tcx>) -> Ty<'tcx> { - tcx.types.unit - } - - #[inline] pub fn new_static_str(tcx: TyCtxt<'tcx>) -> Ty<'tcx> { Ty::new_imm_ref(tcx, tcx.lifetimes.re_static, tcx.types.str_) } |
