From a6028263d2c9c3568f86e57d6b8400e05d3cfe1b Mon Sep 17 00:00:00 2001 From: lqd Date: Fri, 25 Jan 2019 18:35:47 +0100 Subject: [PATCH] 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. --- .../nice_region_error/placeholder_error.rs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index 7ece3d38a7f..636b66bef01 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -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( SubregionOrigin::Subtype(TypeTrace { cause,