diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-10-01 22:14:57 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-01 22:14:57 +1000 |
| commit | 5b6978a1fd9e3f7cc18a1de7a9028e5f290b9008 (patch) | |
| tree | ecbb1ec22cf195e8848ec8179ffbeeb325fba525 /tests | |
| parent | 1e1a39441bd11aba541a48ba714d939490fc7b85 (diff) | |
| parent | 465e373542b529055cd1302849f79db13a617a98 (diff) | |
| download | rust-5b6978a1fd9e3f7cc18a1de7a9028e5f290b9008.tar.gz rust-5b6978a1fd9e3f7cc18a1de7a9028e5f290b9008.zip | |
Rollup merge of #146918 - lcnr:add-regression-test, r=jdonszelmann
add regression test closes rust-lang/rust#128887 the errors in that issue are due to two separate issues: - MIR inlining causing the trait solver to hit the recursion limit (partially fixed in rust-lang/rust#129714) - using subtyping in method selection for paths (fixed in https://github.com/rust-lang/rust/pull/129073) We moved any remaining issues due to MIR inlining into https://github.com/rust-lang/rust/issues/131960, but keeping rust-lang/rust#128887 open as well seems unhelpful and confusing.
Diffstat (limited to 'tests')
| -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() {} |
