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_mir_build/src | |
| parent | fe62bc5ea5302155558b053fee3d9aa6ed6fcad8 (diff) | |
| parent | 1c9a61d2111c93407018c99e15ddd78ea18a234e (diff) | |
| download | rust-d6940fb43d7c81d1b4e8fd2e3f699f3b43f0cc1a.tar.gz rust-d6940fb43d7c81d1b4e8fd2e3f699f3b43f0cc1a.zip | |
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_mir_build/src')
| -rw-r--r-- | compiler/rustc_mir_build/src/build/mod.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/cx/mod.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index 3c18afe1a78..d6e6cc957b4 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -997,7 +997,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { match self.unit_temp { Some(tmp) => tmp, None => { - let ty = Ty::new_unit(self.tcx); + let ty = self.tcx.types.unit; let fn_span = self.fn_span; let tmp = self.temp(ty, fn_span); self.unit_temp = Some(tmp); diff --git a/compiler/rustc_mir_build/src/thir/cx/mod.rs b/compiler/rustc_mir_build/src/thir/cx/mod.rs index f4f591d15b9..79738b54035 100644 --- a/compiler/rustc_mir_build/src/thir/cx/mod.rs +++ b/compiler/rustc_mir_build/src/thir/cx/mod.rs @@ -15,7 +15,7 @@ use rustc_hir::HirId; use rustc_hir::Node; use rustc_middle::middle::region; use rustc_middle::thir::*; -use rustc_middle::ty::{self, RvalueScopes, Ty, TyCtxt}; +use rustc_middle::ty::{self, RvalueScopes, TyCtxt}; pub(crate) fn thir_body( tcx: TyCtxt<'_>, @@ -39,7 +39,7 @@ pub(crate) fn thir_body( // It will always be `()` in this case. if tcx.is_coroutine(owner_def.to_def_id()) && body.params.is_empty() { cx.thir.params.push(Param { - ty: Ty::new_unit(tcx), + ty: tcx.types.unit, pat: None, ty_span: None, self_kind: None, |
