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

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

View file

@ -1750,11 +1750,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_)