Skip to content

Commit a602826

Browse files
committed
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.
1 parent c1437c9 commit a602826

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,30 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
9696
))
9797
}
9898

99+
Some(RegionResolutionError::SubSupConflict(
100+
vid,
101+
_,
102+
_,
103+
_,
104+
SubregionOrigin::Subtype(TypeTrace {
105+
cause,
106+
values: ValuePairs::TraitRefs(ExpectedFound { expected, found }),
107+
}),
108+
sup_placeholder @ ty::RePlaceholder(_),
109+
))
110+
if expected.def_id == found.def_id =>
111+
{
112+
Some(self.try_report_placeholders_trait(
113+
Some(self.tcx().mk_region(ty::ReVar(*vid))),
114+
cause,
115+
None,
116+
Some(*sup_placeholder),
117+
expected.def_id,
118+
expected.substs,
119+
found.substs,
120+
))
121+
}
122+
99123
Some(RegionResolutionError::ConcreteFailure(
100124
SubregionOrigin::Subtype(TypeTrace {
101125
cause,

0 commit comments

Comments
 (0)