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
15
src/test/ui/suggestions/tuple-float-index.rs
Normal file
15
src/test/ui/suggestions/tuple-float-index.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
fn main () {
|
||||
(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