about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorJonathan Goodman <goodmanjonathan@sbcglobal.net>2019-07-13 19:34:06 -0500
committerJonathan Goodman <goodmanjonathan@sbcglobal.net>2019-07-13 19:46:13 -0500
commit7111328556e0580f1323cde3d5193eb8d2767693 (patch)
treec425dee1a7ec6f9f910b37d3b579e9d381774696 /src/libsyntax/parse/parser.rs
parent69656fa4cbafc378fd63f9186d93b0df3cdd9320 (diff)
downloadrust-7111328556e0580f1323cde3d5193eb8d2767693.tar.gz
rust-7111328556e0580f1323cde3d5193eb8d2767693.zip
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 #62660.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 83030e89af3..aca63705f3d 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -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);
         }