Use proper span for tuple index parsed as float
Fix diagnostic suggestion from: ```rust help: try parenthesizing the first index | (1, (2, 3)).((1, (2, 3)).1).1; ``` to the correct: ```rust help: try parenthesizing the first index | ((1, (2, 3)).1).1; ```
This commit is contained in:
parent
5309a3e31d
commit
44e414c477
3 changed files with 15 additions and 6 deletions
|
|
@ -11,7 +11,5 @@
|
|||
// compile-flags: -Z parse-only
|
||||
|
||||
fn main () {
|
||||
(1, (2, 3)).1.1; //~ ERROR unexpected token
|
||||
//~^ HELP try parenthesizing the first index
|
||||
//~| SUGGESTION ((1, (2, 3)).1).1
|
||||
(1, (2, 3)).1.1;
|
||||
}
|
||||
11
src/test/ui/suggestions/tuple-float-index.stderr
Normal file
11
src/test/ui/suggestions/tuple-float-index.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error: unexpected token: `1.1`
|
||||
--> $DIR/tuple-float-index.rs:14:17
|
||||
|
|
||||
14 | (1, (2, 3)).1.1;
|
||||
| ^^^ unexpected token
|
||||
|
|
||||
help: try parenthesizing the first index
|
||||
| ((1, (2, 3)).1).1;
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue