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.
This commit is contained in:
parent
69656fa4cb
commit
7111328556
3 changed files with 20 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue