diff options
| author | Oneirical <manchot@videotron.ca> | 2025-07-13 15:56:27 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2025-07-24 17:01:44 -0400 |
| commit | a924d44115b632775ef0d2e12382e285953b0c2c (patch) | |
| tree | 4cb6005288fc4a7407006094892fcf577f3f30cf /tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs | |
| parent | 246733a3d978de41c5b77b8120ba8f41592df9f1 (diff) | |
| download | rust-a924d44115b632775ef0d2e12382e285953b0c2c.tar.gz rust-a924d44115b632775ef0d2e12382e285953b0c2c.zip | |
Rehome tests/ui/issues/ tests [1/?]
Diffstat (limited to 'tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs')
| -rw-r--r-- | tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs new file mode 100644 index 00000000000..0875d385ddc --- /dev/null +++ b/tests/ui/recursion/recursive-impl-trait-iterator-by-ref-67552.rs @@ -0,0 +1,33 @@ +//@ build-fail +//@ compile-flags: -Copt-level=0 + +fn main() { + rec(Empty); +} + +struct Empty; + +impl Iterator for Empty { + type Item = (); + fn next<'a>(&'a mut self) -> core::option::Option<()> { + None + } +} + +fn identity<T>(x: T) -> T { + x +} + +fn rec<T>(mut it: T) +where + T: Iterator, +{ + if () == () { + T::count(it); + } else { + rec(identity(&mut it)) + //~^ ERROR reached the recursion limit while instantiating + } +} + +// https://github.com/rust-lang/rust/issues/67552 |
