-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Accept tuple.0.0 as tuple indexing #70420
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12a5e49
Lex tuple.0.0 as tuple indexing
dtolnay f58e485
Remove tuple-float-index ui test that now compiles
dtolnay 550b50b
Add test of tuple nested indexing
dtolnay ead9325
Remove obsolete recovery of field access by float
dtolnay 9d51f49
Test even deeper nested indexing
dtolnay 34999af
Test a range, which is not nested indexing
dtolnay 96f03d8
Add tests in which the token really is a float
dtolnay 22e0242
Add test for tuple indexed with float in macro input
dtolnay ec8ff74
Add test for errors triggered on parts of decomposed index
dtolnay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,7 @@ | ||
fn main() { | ||
let tuple = (((),),); | ||
|
||
let _ = tuple. 0.0; //~ ERROR unexpected token: `0.0` | ||
|
||
let _ = tuple./*special cases*/0.0; //~ ERROR unexpected token: `0.0` | ||
} |
This file contains hidden or 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,14 @@ | ||
error: unexpected token: `0.0` | ||
--> $DIR/index-float.rs:4:20 | ||
| | ||
LL | let _ = tuple. 0.0; | ||
| ^^^ | ||
|
||
error: unexpected token: `0.0` | ||
--> $DIR/index-float.rs:6:36 | ||
| | ||
LL | let _ = tuple./*special cases*/0.0; | ||
| ^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains hidden or 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,7 @@ | ||
fn main() { | ||
let _ = (((),),).1.0; //~ ERROR no field `1` on type `(((),),)` | ||
|
||
let _ = (((),),).0.1; //~ ERROR no field `1` on type `((),)` | ||
|
||
let _ = (((),),).000.000; //~ ERROR no field `000` on type `(((),),)` | ||
} |
This file contains hidden or 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,21 @@ | ||
error[E0609]: no field `1` on type `(((),),)` | ||
--> $DIR/index-invalid.rs:2:22 | ||
| | ||
LL | let _ = (((),),).1.0; | ||
| ^ | ||
|
||
error[E0609]: no field `1` on type `((),)` | ||
--> $DIR/index-invalid.rs:4:24 | ||
| | ||
LL | let _ = (((),),).0.1; | ||
| ^ | ||
|
||
error[E0609]: no field `000` on type `(((),),)` | ||
--> $DIR/index-invalid.rs:6:22 | ||
| | ||
LL | let _ = (((),),).000.000; | ||
| ^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0609`. |
This file contains hidden or 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 @@ | ||
// Broken by https://github.com/rust-lang/rust/pull/70420. | ||
|
||
macro_rules! m { | ||
(.$l:literal) => {}; | ||
} | ||
|
||
m!(.0.0); //~ ERROR no rules expected the token `.` | ||
|
||
fn main() {} |
This file contains hidden or 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,11 @@ | ||
error: no rules expected the token `.` | ||
--> $DIR/indexing-in-macro.rs:7:6 | ||
| | ||
LL | macro_rules! m { | ||
| -------------- when calling this macro | ||
... | ||
LL | m!(.0.0); | ||
| ^ no rules expected this token in macro call | ||
|
||
error: aborting due to previous error | ||
|
This file contains hidden or 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,12 @@ | ||
// run-pass | ||
|
||
fn main () { | ||
let n = (1, (2, 3)).1.1; | ||
assert_eq!(n, 3); | ||
|
||
let n = (1, (2, (3, 4))).1.1.1; | ||
assert_eq!(n, 4); | ||
|
||
// This is a range expression, not nested indexing. | ||
let _ = 0.0..1.1; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Happy to see this method go; it was ungreat to refactor in the past :) 🎉