summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_trait_selection/src/traits/query/normalize.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /compiler/rustc_trait_selection/src/traits/query/normalize.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/query/normalize.rs')
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/normalize.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
index f785211c5..2e31b560b 100644
--- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs
@@ -230,17 +230,14 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
Reveal::All => {
let args = data.args.try_fold_with(self)?;
let recursion_limit = self.interner().recursion_limit();
+
if !recursion_limit.value_within_limit(self.anon_depth) {
- // A closure or generator may have itself as in its upvars.
- // This should be checked handled by the recursion check for opaque
- // types, but we may end up here before that check can happen.
- // In that case, we delay a bug to mark the trip, and continue without
- // revealing the opaque.
- self.infcx
+ let guar = self
+ .infcx
.err_ctxt()
.build_overflow_error(&ty, self.cause.span, true)
.delay_as_bug();
- return ty.try_super_fold_with(self);
+ return Ok(Ty::new_error(self.interner(), guar));
}
let generic_ty = self.interner().type_of(data.def_id);
@@ -293,7 +290,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
_ => unreachable!(),
}?;
// We don't expect ambiguity.
- if result.is_ambiguous() {
+ if !result.value.is_proven() {
// Rustdoc normalizes possibly not well-formed types, so only
// treat this as a bug if we're not in rustdoc.
if !tcx.sess.opts.actually_rustdoc {