From 465e373542b529055cd1302849f79db13a617a98 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 23 Sep 2025 07:55:43 +0200 Subject: [PATCH] add regression test --- tests/ui/methods/overflow-if-subtyping.rs | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/ui/methods/overflow-if-subtyping.rs diff --git a/tests/ui/methods/overflow-if-subtyping.rs b/tests/ui/methods/overflow-if-subtyping.rs new file mode 100644 index 0000000000000..a97f29f1f6dfc --- /dev/null +++ b/tests/ui/methods/overflow-if-subtyping.rs @@ -0,0 +1,30 @@ +//@ check-pass + +// Regression test for #128887. +#![allow(unconditional_recursion)] +trait Mappable { + type Output; +} + +trait Bound {} +// Deleting this impl made it compile on beta +impl Bound for T {} + +trait Generic {} + +// Deleting the `: Mappable` already made it error on stable. +struct IndexWithIter, T>(I, M, T); + +impl IndexWithIter +where + >::Output: Bound, + // Flipping these where bounds causes this to succeed, even when removing + // the where-clause on the struct definition. + M: Mappable, + I: Generic, +{ + fn new(x: I) { + IndexWithIter::<_, _, _>::new(x); + } +} +fn main() {}