HACK: avoid hang in structurally_normalize
This commit is contained in:
parent
8eade3aa71
commit
8024c69c29
1 changed files with 9 additions and 3 deletions
|
@ -22,9 +22,14 @@ impl<'tcx> StructurallyNormalizeExt<'tcx> for At<'_, 'tcx> {
|
||||||
assert!(!ty.is_ty_var(), "should have resolved vars before calling");
|
assert!(!ty.is_ty_var(), "should have resolved vars before calling");
|
||||||
|
|
||||||
if self.infcx.next_trait_solver() {
|
if self.infcx.next_trait_solver() {
|
||||||
while let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, projection_ty) =
|
// FIXME(-Ztrait-solver=next): correctly handle
|
||||||
*ty.kind()
|
// overflow here.
|
||||||
{
|
for _ in 0..256 {
|
||||||
|
let ty::Alias(ty::Projection | ty::Inherent | ty::Weak, projection_ty) = *ty.kind()
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
let new_infer_ty = self.infcx.next_ty_var(TypeVariableOrigin {
|
let new_infer_ty = self.infcx.next_ty_var(TypeVariableOrigin {
|
||||||
kind: TypeVariableOriginKind::NormalizeProjectionType,
|
kind: TypeVariableOriginKind::NormalizeProjectionType,
|
||||||
span: self.cause.span,
|
span: self.cause.span,
|
||||||
|
@ -49,6 +54,7 @@ impl<'tcx> StructurallyNormalizeExt<'tcx> for At<'_, 'tcx> {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ty)
|
Ok(ty)
|
||||||
} else {
|
} else {
|
||||||
Ok(self.normalize(ty).into_value_registering_obligations(self.infcx, fulfill_cx))
|
Ok(self.normalize(ty).into_value_registering_obligations(self.infcx, fulfill_cx))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue