-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Suggests turbofish in patterns #114300
Merged
Merged
Suggests turbofish in patterns #114300
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
049c728
Suggests turbofish in patterns
mu001999 89b2fe7
Keep the suggestion for wrong arbitrary self types
mu001999 f5243d2
Fix rustfmt dep
mu001999 41e85c3
Apply suggestions
mu001999 8c8af6c
Avoid too many expected symbols and reduce `None`s
mu001999 dce7e87
Reduce arbitrary self type suggestions
mu001999 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 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
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,11 @@ | ||
enum E<T> { | ||
A(T) | ||
} | ||
|
||
fn main() { | ||
match E::<i32>::A(1) { | ||
E<i32>::A(v) => { //~ ERROR generic args in patterns require the turbofish syntax | ||
println!("{v:?}"); | ||
}, | ||
} | ||
} |
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,13 @@ | ||
error: generic args in patterns require the turbofish syntax | ||
--> $DIR/issue-114112.rs:7:10 | ||
| | ||
LL | E<i32>::A(v) => { | ||
| ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments | ||
| | ||
LL | E::<i32>::A(v) => { | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<` | ||
error: generic args in patterns require the turbofish syntax | ||
--> $DIR/issue-22647.rs:2:15 | ||
| | ||
LL | let caller<F> = |f: F| | ||
| ^ expected one of `:`, `;`, `=`, `@`, or `|` | ||
| ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments | ||
| | ||
LL | let caller::<F> = |f: F| | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
error: expected one of `:`, `;`, `=`, `@`, or `|`, found `<` | ||
error: generic args in patterns require the turbofish syntax | ||
--> $DIR/issue-22712.rs:6:12 | ||
| | ||
LL | let Foo<Vec<u8>> | ||
| ^ expected one of `:`, `;`, `=`, `@`, or `|` | ||
| ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments | ||
| | ||
LL | let Foo::<Vec<u8>> | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
|
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
error: expected one of `=>`, `@`, `if`, or `|`, found `<` | ||
error: generic args in patterns require the turbofish syntax | ||
--> $DIR/pat-lt-bracket-3.rs:6:16 | ||
| | ||
LL | Foo<T>(x, y) => { | ||
| ^ expected one of `=>`, `@`, `if`, or `|` | ||
| ^ | ||
| | ||
help: use `::<...>` instead of `<...>` to specify lifetime, type, or const arguments | ||
| | ||
LL | Foo::<T>(x, y) => { | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.
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.
Looking at this error, the suggestion we should be giving is to add a type, but don't know how hard it would be to change.
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.
Like function parameters, maybe we can also suggest
name: caller<F>
or_: caller<F>
? I think it may be more general, becausecaller<F>
is more like a type.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.
Yeah, I think the later is the better suggestion (particularly if the rest can be parsed as a type until
;
or=
is reached).