-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Empty iterator error #100751
Empty iterator error #100751
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the contribution! Could you please write this as a lint? (See rustc-dev-guide) You could also take a look at how clippy implemented this.
This comment has been minimized.
This comment has been minimized.
I'm available on Zulip if you need any help. |
If done as a late lint I think this could also evaluate constants, for example const A: u32 = 10;
const B: u32 = 0;
fn main() {
for i in A..B {
println!("{i}");
}
} |
@rustbot author marking as waiting on author to address comments. |
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
This comment has been minimized.
This comment has been minimized.
@rustbot ready |
@rustbot author |
src/test/ui/borrowck/borrowck-for-loop-uninitialized-binding.stderr
Outdated
Show resolved
Hide resolved
This is a lint with a lot of room for enhancement. Static value range analysis could be used to reveal empty ranges |
I was also wondering about this. Clippy has the lint. However I think it would be nice to just add the @rust-lang/compiler opinions? |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
5fca1a9
to
25580e3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #102652) made this pull request unmergeable. Please resolve the merge conflicts. |
@rustbot modify labels: -A-rustdoc-json |
☔ The latest upstream changes (presumably #104809) made this pull request unmergeable. Please resolve the merge conflicts. |
@obeis any updates on this? |
Closing as this should live in clippy for now. |
Closes #100635