Do not ICE on HIR based WF check when involving lifetimes

Fix #87549.
This commit is contained in:
Esteban Küber 2021-08-06 02:36:54 -07:00 committed by Esteban Kuber
parent d4ad1cfc63
commit f93cbedade
3 changed files with 49 additions and 3 deletions

View file

@ -245,9 +245,10 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
if let ObligationCauseCode::WellFormed(Some(wf_loc)) =
root_obligation.cause.code.peel_derives()
{
if let Some(cause) =
self.tcx.diagnostic_hir_wf_check((obligation.predicate, wf_loc.clone()))
{
if let Some(cause) = self.tcx.diagnostic_hir_wf_check((
tcx.erase_regions(obligation.predicate),
wf_loc.clone(),
)) {
obligation.cause = cause;
span = obligation.cause.span;
}