Handle higher-ranked lifetime conflict errors where the subtype is the sup region

These are happening since the switch to universes, and will now go through the "placeholder error" path, instead of the current fallback of E308 "mismatched types" errors.
This commit is contained in:
lqd 2019-01-25 18:35:47 +01:00 committed by Rémy Rakic
parent c1437c944c
commit a6028263d2

View file

@ -96,6 +96,30 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
)) ))
} }
Some(RegionResolutionError::SubSupConflict(
vid,
_,
_,
_,
SubregionOrigin::Subtype(TypeTrace {
cause,
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
}),
sup_placeholder @ ty::RePlaceholder(_),
))
if expected.def_id == found.def_id =>
{
Some(self.try_report_placeholders_trait(
Some(self.tcx().mk_region(ty::ReVar(*vid))),
cause,
None,
Some(*sup_placeholder),
expected.def_id,
expected.substs,
found.substs,
))
}
Some(RegionResolutionError::ConcreteFailure( Some(RegionResolutionError::ConcreteFailure(
SubregionOrigin::Subtype(TypeTrace { SubregionOrigin::Subtype(TypeTrace {
cause, cause,