Auto merge of #104610 - ouz-a:revert-overflow, r=compiler-errors

Reverts check done by #100757

As my `fix` caused more issues than it resolved it's better to revert it.
( #103274 #104322 https://github.com/rust-lang/rust/issues/104606)

r? `@compiler-errors`

Reopens #95134
This commit is contained in:
bors 2022-11-24 03:29:04 +00:00
commit fd815a5091
6 changed files with 13 additions and 29 deletions

View file

@ -566,22 +566,6 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> {
.flatten()
.unwrap_or_else(|| ty.super_fold_with(self).into())
};
// For cases like #95134 we would like to catch overflows early
// otherwise they slip away and cause ICE.
let recursion_limit = self.tcx().recursion_limit();
if !recursion_limit.value_within_limit(self.depth)
// HACK: Don't overflow when running cargo doc see #100991
&& !self.tcx().sess.opts.actually_rustdoc
{
let obligation = Obligation::with_depth(
self.selcx.tcx(),
self.cause.clone(),
recursion_limit.0,
self.param_env,
ty,
);
self.selcx.infcx().err_ctxt().report_overflow_error(&obligation, true);
}
debug!(
?self.depth,
?ty,