From 6df1b2df261efb2c1c2f09ff3617210f77b92492 Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 9 Mar 2026 07:19:18 +0100 Subject: [PATCH 1/2] `FindParamInClause` non-global on overflow --- .../src/solve/assembly/mod.rs | 42 +++++++++++-------- .../normalize-param-env-4.next.stderr | 20 ++++++++- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs index 038168ca638b4..15da2cba6bd59 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs @@ -1273,16 +1273,19 @@ where return ControlFlow::Break(Err(NoSolution)); }; - if let ty::Placeholder(p) = ty.kind() { - if p.universe() == ty::UniverseIndex::ROOT { - ControlFlow::Break(Ok(())) - } else { - ControlFlow::Continue(()) + match ty.kind() { + ty::Placeholder(p) => { + if p.universe() == ty::UniverseIndex::ROOT { + ControlFlow::Break(Ok(())) + } else { + ControlFlow::Continue(()) + } } - } else if ty.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_RE_INFER) { - ty.super_visit_with(self) - } else { - ControlFlow::Continue(()) + ty::Infer(_) => ControlFlow::Break(Ok(())), + _ if ty.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER) => { + ty.super_visit_with(self) + } + _ => ControlFlow::Continue(()), } } @@ -1292,16 +1295,19 @@ where return ControlFlow::Break(Err(NoSolution)); }; - if let ty::ConstKind::Placeholder(p) = ct.kind() { - if p.universe() == ty::UniverseIndex::ROOT { - ControlFlow::Break(Ok(())) - } else { - ControlFlow::Continue(()) + match ct.kind() { + ty::ConstKind::Placeholder(p) => { + if p.universe() == ty::UniverseIndex::ROOT { + ControlFlow::Break(Ok(())) + } else { + ControlFlow::Continue(()) + } } - } else if ct.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_RE_INFER) { - ct.super_visit_with(self) - } else { - ControlFlow::Continue(()) + ty::ConstKind::Infer(_) => ControlFlow::Break(Ok(())), + _ if ct.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER) => { + ct.super_visit_with(self) + } + _ => ControlFlow::Continue(()), } } diff --git a/tests/ui/traits/next-solver/normalize/normalize-param-env-4.next.stderr b/tests/ui/traits/next-solver/normalize/normalize-param-env-4.next.stderr index f5fd9ce9864ce..e91a48f62aec3 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-param-env-4.next.stderr +++ b/tests/ui/traits/next-solver/normalize/normalize-param-env-4.next.stderr @@ -4,6 +4,24 @@ error[E0275]: overflow evaluating the requirement `::Assoc: Trait` LL | ::Assoc: Trait, | ^^^^^ -error: aborting due to 1 previous error +error[E0275]: overflow evaluating the requirement `::Assoc well-formed` + --> $DIR/normalize-param-env-4.rs:19:26 + | +LL | ::Assoc: Trait, + | ^^^^^ + +error[E0275]: overflow evaluating the requirement `T: Trait` + --> $DIR/normalize-param-env-4.rs:32:19 + | +LL | impls_trait::(); + | ^ + | +note: required by a bound in `impls_trait` + --> $DIR/normalize-param-env-4.rs:15:19 + | +LL | fn impls_trait() {} + | ^^^^^ required by this bound in `impls_trait` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0275`. From 3564a3f25956c3483c5c8787a559055255f39cca Mon Sep 17 00:00:00 2001 From: lcnr Date: Mon, 9 Mar 2026 07:59:29 +0100 Subject: [PATCH 2/2] recur into aliases TODO test --- .../rustc_next_trait_solver/src/solve/assembly/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs index 15da2cba6bd59..10721bdaa636c 100644 --- a/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs @@ -1282,7 +1282,10 @@ where } } ty::Infer(_) => ControlFlow::Break(Ok(())), - _ if ty.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER) => { + _ if ty.has_type_flags( + TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER | TypeFlags::HAS_ALIAS, + ) => + { ty.super_visit_with(self) } _ => ControlFlow::Continue(()), @@ -1304,7 +1307,10 @@ where } } ty::ConstKind::Infer(_) => ControlFlow::Break(Ok(())), - _ if ct.has_type_flags(TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER) => { + _ if ct.has_type_flags( + TypeFlags::HAS_PLACEHOLDER | TypeFlags::HAS_INFER | TypeFlags::HAS_ALIAS, + ) => + { ct.super_visit_with(self) } _ => ControlFlow::Continue(()),