1
Fork 0

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?
This commit is contained in:
Matthias Krüger 2024-05-02 19:42:50 +02:00 committed by GitHub
commit d6940fb43d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 51 additions and 57 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,