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:
commit
d6940fb43d
20 changed files with 51 additions and 57 deletions
|
@ -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) {
|
||||
|
|
|
@ -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(..)) => (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue