HACK: avoid hang in structurally_normalize
This commit is contained in:
parent
8eade3aa71
commit
8024c69c29
@ -22,9 +22,14 @@ fn structurally_normalize(
|
|||||||
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 @@ fn structurally_normalize(
|
|||||||
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…
Reference in New Issue
Block a user