Check that alias-relate terms are WF if reporting an error in alias-relate
This commit is contained in:
parent
921645c737
commit
93ee07c756
11 changed files with 43 additions and 167 deletions
|
@ -515,6 +515,30 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> {
|
|||
self.with_derived_obligation(obligation, |this| nested_goal.visit_with(this))?;
|
||||
}
|
||||
|
||||
// alias-relate may fail because the lhs or rhs can't be normalized,
|
||||
// and therefore is treated as rigid.
|
||||
if let Some(ty::PredicateKind::AliasRelate(lhs, rhs, _)) = pred_kind.no_bound_vars() {
|
||||
if let Some(obligation) = goal
|
||||
.infcx()
|
||||
.visit_proof_tree(
|
||||
goal.goal().with(goal.infcx().tcx, ty::ClauseKind::WellFormed(lhs.into())),
|
||||
self,
|
||||
)
|
||||
.break_value()
|
||||
{
|
||||
return ControlFlow::Break(obligation);
|
||||
} else if let Some(obligation) = goal
|
||||
.infcx()
|
||||
.visit_proof_tree(
|
||||
goal.goal().with(goal.infcx().tcx, ty::ClauseKind::WellFormed(rhs.into())),
|
||||
self,
|
||||
)
|
||||
.break_value()
|
||||
{
|
||||
return ControlFlow::Break(obligation);
|
||||
}
|
||||
}
|
||||
|
||||
ControlFlow::Break(self.obligation.clone())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue