This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 6d0f160
committed
Auto merge of rust-lang#138835 - joboet:fold-via-try_fold, r=<try>
core: implement `fold` via `try_fold`
... and `rfold` via `try_rfold`. It's not possible to implement `try_fold` via `fold`, so this cannot lead to recursion. While unfortunately `try_fold` cannot be currently implemented for user types on stable, this paves a path to a future where implementing a good `try_fold` is enough to make nearly all `Iterator` traversal methods perform optimally.
r? libs-apiFile tree
3 files changed
+6
-24
lines changed- library
- alloc/src/collections/vec_deque
- core/src/iter/traits
3 files changed
+6
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 117 | | |
128 | 118 | | |
129 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
| 306 | + | |
311 | 307 | | |
312 | 308 | | |
313 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
2550 | 2550 | | |
2551 | 2551 | | |
2552 | 2552 | | |
2553 | | - | |
| 2553 | + | |
2554 | 2554 | | |
2555 | 2555 | | |
2556 | 2556 | | |
2557 | 2557 | | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
| 2558 | + | |
2563 | 2559 | | |
2564 | 2560 | | |
2565 | 2561 | | |
| |||
0 commit comments