Skip to content
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

Adding a hint on iterator type errors #106728

Closed
petar-dambovaliev opened this issue Jan 11, 2023 · 8 comments · Fixed by #106740
Closed

Adding a hint on iterator type errors #106728

petar-dambovaliev opened this issue Jan 11, 2023 · 8 comments · Fixed by #106740
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@petar-dambovaliev
Copy link
Contributor

petar-dambovaliev commented Jan 11, 2023

rust version: rustc 1.66.0 (69f9c33d7 2022-12-12)

error[E0277]: `{float}` is not an iterator
  --> tests/core.rs:44:14
   |
44 |     for i in 0.200 {
   |              ^^^^^ `{float}` is not an iterator

Do you think it would be useful to add a hint here?
Something in the lines of Did you mean for i 0..200 {

@petar-dambovaliev petar-dambovaliev added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2023
@clubby789
Copy link
Contributor

@rustbot claim

@petar-dambovaliev
Copy link
Contributor Author

petar-dambovaliev commented Jan 11, 2023

@clubby789 i was hoping this to be my first PR to the compiler, if accepted as necessary. :D
I need some guidance as to where this code might be though...

@tdelabro
Copy link
Contributor

@rustbot claim

@rustbot rustbot assigned tdelabro and unassigned clubby789 Jan 11, 2023
@tdelabro
Copy link
Contributor

hups sorry

@tdelabro tdelabro removed their assignment Jan 11, 2023
@tdelabro
Copy link
Contributor

I was testing the bot feature

@clubby789
Copy link
Contributor

clubby789 commented Jan 11, 2023

@petar-dambovaliev

I need some guidance as to where this code might be though...

The 'is not an iterator' message comes from the rustc_on_unimplemented attribute. One solution would be to add a new case to that attribute which detects literals of the form <lhs>.<rhs> (where both sides are numeric) and suggests the iterator syntax.

@petar-dambovaliev
Copy link
Contributor Author

rustc_on_unimplemented

thanks!

@petar-dambovaliev
Copy link
Contributor Author

@clubby789 is this in the right direction? #106740

@bors bors closed this as completed in 7e5d477 Jan 13, 2023
thomcc pushed a commit to tcdi/postgrestd that referenced this issue May 31, 2023
…lstrieb

Adding a hint on iterator type errors

Issue reference rust-lang/rust#106728

- [x] add a case in the attribute
- [x] add a test

closes #106728
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants