-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
size_hint
can be malformed from rustc_middle::mir::traversal::Postorder
#137919
Labels
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
should this be a debug assertion? 🤔 |
@matthiaskrgr I definitely want to check in some form of checking this! Probably as |
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 3, 2025
…<try> Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc rust-lang#137919); let's see if we can get away with a loose but trivially-correct one.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 4, 2025
…<try> Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc rust-lang#137919); let's see if we can get away with a loose but trivially-correct one.
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Mar 4, 2025
…r=tmiasko Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc rust-lang#137919); let's see if we can get away with a loose but trivially-correct one.
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Mar 5, 2025
…r=tmiasko Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc rust-lang#137919); let's see if we can get away with a loose but trivially-correct one.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 5, 2025
Rollup merge of rust-lang#137923 - scottmcm:fix-postorder-size-hint, r=tmiasko Simplify `<Postorder as Iterator>::size_hint` The current version is sometimes malformed (cc rust-lang#137919); let's see if we can get away with a loose but trivially-correct one.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 16, 2025
Rollup merge of rust-lang#138329 - scottmcm:assert-hint, r=Mark-Simulacrum debug-assert that the size_hint is well-formed in `collect` Closes rust-lang#137919 In the hopes of helping to catch any future accidentally-incorrect rustc or stdlib iterators (like the ones rust-lang#137908 accidentally found), this has `Iterator::collect` call `size_hint` and check its `low` doesn't exceed its `Some(high)`. There's of course a bazillion more places this *could* be checked, but the hope is that this one is a good tradeoff of being likely to catch lots of things while having minimal maintenance cost (especially compared to putting it in *every* container's `from_iter`).
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this issue
Mar 19, 2025
…acrum debug-assert that the size_hint is well-formed in `collect` Closes rust-lang#137919 In the hopes of helping to catch any future accidentally-incorrect rustc or stdlib iterators (like the ones rust-lang#137908 accidentally found), this has `Iterator::collect` call `size_hint` and check its `low` doesn't exceed its `Some(high)`. There's of course a bazillion more places this *could* be checked, but the hope is that this one is a good tradeoff of being likely to catch lots of things while having minimal maintenance cost (especially compared to putting it in *every* container's `from_iter`).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-MIR
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Spotted with extra checking from 804cf26
The text was updated successfully, but these errors were encountered: