From 2d434e2ed4a86a85a376aafb9295520a7f787a35 Mon Sep 17 00:00:00 2001 From: Diego Augusto Santos Ferreira Date: Sun, 18 Oct 2026 12:47:25 -0300 Subject: [PATCH] Add regression test for unconstrained const param ICE in next solver --- ...onst-param-supertrait-projection-152415.rs | 22 +++++++++++++++++++ ...-param-supertrait-projection-152415.stderr | 12 ++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.rs create mode 100644 tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.stderr diff --git a/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.rs b/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.rs new file mode 100644 index 0000000000000..d08723953f211 --- /dev/null +++ b/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.rs @@ -0,0 +1,22 @@ +//! Reporting the unconstrained const param error used to hit +//! `assertion failed: !origin.span.is_dummy()` with the new solver. +//! +//! Regression test for . +//@ compile-flags: -Znext-solver + +trait Super { + type Assoc; +} + +trait Mirror { + type Assoc; +} + +impl Mirror for T { + //~^ ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates + type Assoc = T; +} + +trait Foo: Super<::Assoc, Assoc = A> {} + +fn main() {} diff --git a/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.stderr b/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.stderr new file mode 100644 index 0000000000000..0a7675e256fa4 --- /dev/null +++ b/tests/ui/traits/next-solver/unconstrained-const-param-supertrait-projection-152415.stderr @@ -0,0 +1,12 @@ +error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates + --> $DIR/unconstrained-const-param-supertrait-projection-152415.rs:15:9 + | +LL | impl Mirror for T { + | ^^^^^^^^^^^^^^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0207`.