-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggest array indexing when tuple indexing on an array #54292
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ error[E0609]: no field `0` on type `[{integer}; 5]` | |
--> $DIR/issue-53712.rs:5:9 | ||
| | ||
LL | arr.0; | ||
| ^ help: attempting to use tuple indexing on an array; try: `arr[0]` | ||
| ^ help: instead of using tuple indexing, use array indexing: `arr[0]` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realized that the suggestion span is slightly incorrect. The suggestion span should cover the entire expression, otherwise when applying the suggestion with
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, right you are! |
||
|
||
error: aborting due to previous error | ||
|
||
|
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.
You probably want to use
expr.span
here instead offield.span
.