forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't drop DiagnosticBuilder if parsing fails
If the explicitly given type of a `self` parameter fails to parse correctly, we need to propagate the error rather than dropping it and causing an ICE. Fixes rust-lang#62660.
- Loading branch information
1 parent
69656fa
commit 7111328
Showing
3 changed files
with
20 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Regression test for issue #62660: if a receiver's type does not | ||
// successfully parse, emit the correct error instead of ICE-ing the compiler. | ||
|
||
struct Foo; | ||
|
||
impl Foo { | ||
pub fn foo(_: i32, self: Box<Self) {} | ||
//~^ ERROR expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `)` | ||
} | ||
|
||
fn main() {} |
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,8 @@ | ||
error: expected one of `!`, `(`, `+`, `,`, `::`, `<`, or `>`, found `)` | ||
--> $DIR/issue-62660.rs:7:38 | ||
| | ||
LL | pub fn foo(_: i32, self: Box<Self) {} | ||
| ^ expected one of 7 possible tokens here | ||
|
||
error: aborting due to previous error | ||
|