forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59421 - estebank:tuple-index-suffix, r=petr…
…ochenkov Reject integer suffix when tuple indexing Fix rust-lang#59418. r? @varkor
- Loading branch information
Showing
5 changed files
with
120 additions
and
74 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
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,18 @@ | ||
struct X(i32,i32,i32); | ||
|
||
fn main() { | ||
let a = X(1, 2, 3); | ||
let b = a.1suffix; | ||
//~^ ERROR suffixes on a tuple index are invalid | ||
println!("{}", b); | ||
let c = (1, 2, 3); | ||
let d = c.1suffix; | ||
//~^ ERROR suffixes on a tuple index are invalid | ||
println!("{}", d); | ||
let s = X { 0suffix: 0, 1: 1, 2: 2 }; | ||
//~^ ERROR suffixes on a tuple index are invalid | ||
match s { | ||
X { 0suffix: _, .. } => {} | ||
//~^ ERROR suffixes on a tuple index are invalid | ||
} | ||
} |
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,26 @@ | ||
error: suffixes on a tuple index are invalid | ||
--> $DIR/issue-59418.rs:5:15 | ||
| | ||
LL | let b = a.1suffix; | ||
| ^^^^^^^ invalid suffix `suffix` | ||
|
||
error: suffixes on a tuple index are invalid | ||
--> $DIR/issue-59418.rs:9:15 | ||
| | ||
LL | let d = c.1suffix; | ||
| ^^^^^^^ invalid suffix `suffix` | ||
|
||
error: suffixes on a tuple index are invalid | ||
--> $DIR/issue-59418.rs:12:17 | ||
| | ||
LL | let s = X { 0suffix: 0, 1: 1, 2: 2 }; | ||
| ^^^^^^^ invalid suffix `suffix` | ||
|
||
error: suffixes on a tuple index are invalid | ||
--> $DIR/issue-59418.rs:15:13 | ||
| | ||
LL | X { 0suffix: _, .. } => {} | ||
| ^^^^^^^ invalid suffix `suffix` | ||
|
||
error: aborting due to 4 previous errors | ||
|