From 0271b6b156e602dd8157e3284d37933377c1476c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Fri, 30 Jan 2026 18:25:19 +0100 Subject: [PATCH 1/2] regression test for alias-relate changes in lub --- .../generalize/relate-alias-in-lub.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs diff --git a/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs b/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs new file mode 100644 index 0000000000000..0a948989f9815 --- /dev/null +++ b/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs @@ -0,0 +1,30 @@ +//@ revisions: old next +//@[next] compile-flags: -Znext-solver +//@ ignore-compare-mode-next-solver (explicit revisions) +//@ check-pass +// Reproduces https://github.com/rust-lang/rust/pull/151746#issuecomment-3822930803. +// +// The change we tried to make there caused relating a type variable with an alias inside lub, +// In 5bd20bbd0ba6c0285664e55a1ffc677d7487c98b, we moved around code +// that adds an alias-relate predicate to be earlier, from one shared codepath into several +// distinct code paths. However, we forgot one codepath, through lub, causing an ICE in serde. +// In the end we dropped said commit, but the reproducer is still a useful as test. + +use std::marker::PhantomData; + +pub trait Trait { + type Error; +} + +pub struct Struct(PhantomData); + +impl Trait for () { + type Error = (); +} + +fn main() { + let _: Struct<<() as Trait>::Error> = match loop {} { + b => loop {}, + a => Struct(PhantomData), + }; +} From 629ff9b4aa1f0216b26b44958d114332a793cf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20D=C3=B6nszelmann?= Date: Mon, 2 Feb 2026 12:48:42 +0100 Subject: [PATCH 2/2] Update tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs Co-authored-by: lcnr --- tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs b/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs index 0a948989f9815..a81e18559a391 100644 --- a/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs +++ b/tests/ui/traits/next-solver/generalize/relate-alias-in-lub.rs @@ -7,7 +7,7 @@ // The change we tried to make there caused relating a type variable with an alias inside lub, // In 5bd20bbd0ba6c0285664e55a1ffc677d7487c98b, we moved around code // that adds an alias-relate predicate to be earlier, from one shared codepath into several -// distinct code paths. However, we forgot one codepath, through lub, causing an ICE in serde. +// distinct code paths. However, we forgot the codepath in `LatticeOp`, causing an ICE in serde. // In the end we dropped said commit, but the reproducer is still a useful as test. use std::marker::PhantomData;