1
Fork 0

Inline & delete Ty::new_unit, since it's just a field access

This commit is contained in:
Waffle Lapkin 2024-05-02 17:49:23 +02:00
parent f92d49b7fe
commit 698d7a031e
19 changed files with 50 additions and 56 deletions

View file

@ -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);

View file

@ -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,