-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Continue parsing after parent type args and suggest using angle brackets #57768
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d38e700
Continune parsing after encountering Trait with paren args
estebank 3235446
Accept parenthesized type args for error recovery
estebank d37a6d8
Suggest usage of angle brackets
estebank 2ab6cef
Do not suggest angle brackets when there are no type arguments
estebank 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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
fn main() { | ||
let v: Vec(&str) = vec!['1', '2']; | ||
//~^ ERROR parenthesized parameters may only be used with a trait | ||
//~^ ERROR parenthesized type parameters may only be used with a `Fn` trait | ||
//~| ERROR mismatched types | ||
} |
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 |
---|---|---|
@@ -1,9 +1,22 @@ | ||
error[E0214]: parenthesized parameters may only be used with a trait | ||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait | ||
--> $DIR/issue-23589.rs:2:15 | ||
| | ||
LL | let v: Vec(&str) = vec!['1', '2']; | ||
| ^^^^^^ only traits may use parentheses | ||
| ^^^^^^ | ||
| | | ||
| only `Fn` traits may use parentheses | ||
| help: use angle brackets instead: `<&str>` | ||
|
||
error: aborting due to previous error | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-23589.rs:2:29 | ||
| | ||
LL | let v: Vec(&str) = vec!['1', '2']; | ||
| ^^^ expected &str, found char | ||
| | ||
= note: expected type `&str` | ||
found type `char` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0214`. | ||
Some errors occurred: E0214, E0308. | ||
For more information about an error, try `rustc --explain E0214`. |
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
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 |
---|---|---|
@@ -1,20 +1,20 @@ | ||
error: field expressions may not have generic arguments | ||
--> $DIR/type-parameters-in-field-exprs.rs:13:8 | ||
--> $DIR/type-parameters-in-field-exprs.rs:13:10 | ||
| | ||
LL | f.x::<isize>; | ||
| ^^^^^^^^^ | ||
| ^^^^^^^ | ||
|
||
error: field expressions may not have generic arguments | ||
--> $DIR/type-parameters-in-field-exprs.rs:15:8 | ||
--> $DIR/type-parameters-in-field-exprs.rs:15:10 | ||
| | ||
LL | f.x::<>; | ||
| ^^^^ | ||
| ^^ | ||
|
||
error: field expressions may not have generic arguments | ||
--> $DIR/type-parameters-in-field-exprs.rs:17:8 | ||
--> $DIR/type-parameters-in-field-exprs.rs:17:10 | ||
| | ||
LL | f.x::(); | ||
| ^^^^ | ||
| ^^ | ||
|
||
error: aborting due to 3 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
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
15 changes: 11 additions & 4 deletions
15
src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr
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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
error[E0214]: parenthesized parameters may only be used with a trait | ||
error[E0214]: parenthesized type parameters may only be used with a `Fn` trait | ||
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:19 | ||
| | ||
LL | let x: Box<Bar()> = panic!(); | ||
| ^^ only traits may use parentheses | ||
| ^^ only `Fn` traits may use parentheses | ||
|
||
error: aborting due to previous error | ||
error[E0107]: wrong number of type arguments: expected 1, found 0 | ||
--> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:8:16 | ||
| | ||
LL | let x: Box<Bar()> = panic!(); | ||
| ^^^^^ expected 1 type argument | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0214`. | ||
Some errors occurred: E0107, E0214. | ||
For more information about an error, try `rustc --explain E0107`. |
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
9 changes: 6 additions & 3 deletions
9
src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr
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
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.
Uh oh!
There was an error while loading. Please reload this page.