Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suggest array indexing when tuple indexing on an array.
- Loading branch information
1 parent
0c64789
commit 30556d5
Showing
3 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// issue #53712: make the error generated by using tuple indexing on an array more specific | ||
|
||
fn main() { | ||
let arr = [10, 20, 30, 40, 50]; | ||
arr.0; | ||
//~^ ERROR no field `0` on type `[{integer}; 5]` [E0609] | ||
//~| HELP attempting to use tuple indexing on an array; try | ||
//~| SUGGESTION arr[0] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
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]` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0609`. |