diff options
| author | lcnr <rust@lcnr.de> | 2025-09-23 07:55:43 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2025-09-23 08:02:54 +0200 |
| commit | 465e373542b529055cd1302849f79db13a617a98 (patch) | |
| tree | a64a6adb345442ae94c17890f84d3cf6437f270d | |
| parent | f6092f224d2b1774b31033f12d0bee626943b02f (diff) | |
| download | rust-465e373542b529055cd1302849f79db13a617a98.tar.gz rust-465e373542b529055cd1302849f79db13a617a98.zip | |
add regression test
| -rw-r--r-- | tests/ui/methods/overflow-if-subtyping.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/methods/overflow-if-subtyping.rs b/tests/ui/methods/overflow-if-subtyping.rs new file mode 100644 index 00000000000..a97f29f1f6d --- /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<T> { + type Output; +} + +trait Bound<T> {} +// Deleting this impl made it compile on beta +impl<T> Bound<T> for T {} + +trait Generic<M> {} + +// Deleting the `: Mappable<T>` already made it error on stable. +struct IndexWithIter<I, M: Mappable<T>, T>(I, M, T); + +impl<I, M, T> IndexWithIter<I, M, T> +where + <M as Mappable<T>>::Output: Bound<T>, + // Flipping these where bounds causes this to succeed, even when removing + // the where-clause on the struct definition. + M: Mappable<T>, + I: Generic<M>, +{ + fn new(x: I) { + IndexWithIter::<_, _, _>::new(x); + } +} +fn main() {} |
