Skip to content

Further constify Range - #161499

Draft
Randl wants to merge 1 commit into
rust-lang:mainfrom
Randl:const-fold-from-try-fold
Draft

Randl wants to merge 1 commit into
rust-lang:mainfrom
Randl:const-fold-from-try-fold

Conversation

@Randl

@Randl Randl commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This is part of an attempt to fully constify Iterator. Specifically, I'm extracting the changes from the local branch that contains more or less minimal Iterator constification.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 22, 2026
@rustbot

rustbot commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from JohnTitor, Mark-Simulacrum, clarfonthey, nia-e

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.314
error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1393:56
     |
1393 |         F: [const] FnMut(B, Self::Item) -> R + [const] Destruct,
     |                                                        ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1400:56
     |
1400 |         F: [const] FnMut(B, Self::Item) -> R + [const] Destruct,
     |                                                        ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1412:47
     |
1412 |         F: [const] FnMut(B, A) -> R + [const] Destruct,
     |                                               ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1441:47
     |
1441 |         F: [const] FnMut(B, A) -> R + [const] Destruct,
     |                                               ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1473:47
     |
1473 |         F: [const] FnMut(B, T) -> R + [const] Destruct,
     |                                               ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1502:47
     |
1502 |         F: [const] FnMut(B, T) -> R + [const] Destruct,
     |                                               ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1530:38
     |
1530 | const impl<A: [const] Step + [const] Destruct> Iterator for ops::RangeInclusive<A> {
     |                                      ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1586:56
     |
1586 |         F: [const] FnMut(B, Self::Item) -> R + [const] Destruct,
     |                                                        ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/mod.rs:376:66
     |
 359 | / macro_rules! impl_fold_via_try_fold_const {
 360 | |     (fold -> try_fold) => {
 361 | |         impl_fold_via_try_fold_const! { @internal fold -> try_fold }
     | |         ------------------------------------------------------------ in this macro invocation (#2)
 362 | |     };
...    |
 376 | |             FFF: [const] FnMut(AAA, Self::Item) -> AAA + [const] Destruct,
     | |                                                                  ^^^^^^^^ not found in this scope
...    |
 382 | |     };
 383 | | }
     | | -
     | | |
     | |_in this expansion of `impl_fold_via_try_fold_const!` (#1)
     |   in this expansion of `impl_fold_via_try_fold_const!` (#2)
     |
    ::: library/core/src/iter/range.rs:1592:5
     |
1592 |       impl_fold_via_try_fold_const! { fold -> try_fold }
     |       -------------------------------------------------- in this macro invocation (#1)
     |
help: consider importing this trait
    -->  library/core/src/iter/range.rs:1:1
     |
---

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1631:38
     |
1631 | const impl<A: [const] Step + [const] Destruct> DoubleEndedIterator for ops::RangeInclusive<A> {
     |                                      ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/range.rs:1663:56
     |
1663 |         F: [const] FnMut(B, Self::Item) -> R + [const] Destruct,
     |                                                        ^^^^^^^^ not found in this scope
     |
help: consider importing this trait
     |
   1 + use crate::marker::Destruct;
     |

error[E0405]: cannot find trait `Destruct` in this scope
    --> library/core/src/iter/mod.rs:376:66
     |
 359 | / macro_rules! impl_fold_via_try_fold_const {
 360 | |     (fold -> try_fold) => {
 361 | |         impl_fold_via_try_fold_const! { @internal fold -> try_fold }
 362 | |     };
 363 | |     (rfold -> try_rfold) => {
 364 | |         impl_fold_via_try_fold_const! { @internal rfold -> try_rfold }
     | |         -------------------------------------------------------------- in this macro invocation (#2)
...    |
 376 | |             FFF: [const] FnMut(AAA, Self::Item) -> AAA + [const] Destruct,
     | |                                                                  ^^^^^^^^ not found in this scope
...    |
 382 | |     };
 383 | | }
     | | -
     | | |
     | |_in this expansion of `impl_fold_via_try_fold_const!` (#1)
     |   in this expansion of `impl_fold_via_try_fold_const!` (#2)
     |
    ::: library/core/src/iter/range.rs:1669:5
     |
1669 |       impl_fold_via_try_fold_const! { rfold -> try_rfold }
     |       ---------------------------------------------------- in this macro invocation (#1)
     |
help: consider importing this trait
    -->  library/core/src/iter/range.rs:1:1
     |

@Randl
Randl marked this pull request as draft August 22, 2026 11:29
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants