Skip to content
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

[beta] Fix #62660 #62792

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ impl<'a> Parser<'a> {
F: Fn(&token::Token) -> bool
{
let attrs = self.parse_arg_attributes()?;
if let Ok(Some(mut arg)) = self.parse_self_arg() {
if let Some(mut arg) = self.parse_self_arg()? {
arg.attrs = attrs.into();
return self.recover_bad_self_arg(arg, is_trait_item);
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/ui/parser/issue-62660.rs
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() {}
8 changes: 8 additions & 0 deletions src/test/ui/parser/issue-62660.stderr
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