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

@ -781,7 +781,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
&& self.fallback_has_occurred
{
let predicate = trait_predicate.map_bound(|trait_pred| {
trait_pred.with_self_ty(self.tcx, Ty::new_unit(self.tcx))
trait_pred.with_self_ty(self.tcx, tcx.types.unit)
});
let unit_obligation = obligation.with(tcx, predicate);
if self.predicate_may_hold(&unit_obligation) {

View file

@ -519,7 +519,7 @@ fn virtual_call_violations_for_method<'tcx>(
// e.g., `Rc<()>`
let unit_receiver_ty =
receiver_for_self_ty(tcx, receiver_ty, Ty::new_unit(tcx), method.def_id);
receiver_for_self_ty(tcx, receiver_ty, tcx.types.unit, method.def_id);
match abi_of_ty(unit_receiver_ty) {
Some(Abi::Scalar(..)) => (),