diff options
| author | mibac138 <5672750+mibac138@users.noreply.github.com> | 2020-10-14 22:27:48 +0200 |
|---|---|---|
| committer | mibac138 <5672750+mibac138@users.noreply.github.com> | 2020-12-01 12:12:48 +0100 |
| commit | 5404deeb64f4449079f5165ace6bfa1e52ca4b33 (patch) | |
| tree | b4a0cee6781d257ae05ebaf6d8a6cdffc1104946 /compiler/rustc_parse/src/parser/path.rs | |
| parent | c4926d01ada661d4fbffb0e5b1708ae5463d47b3 (diff) | |
| download | rust-5404deeb64f4449079f5165ace6bfa1e52ca4b33.tar.gz rust-5404deeb64f4449079f5165ace6bfa1e52ca4b33.zip | |
Gracefully handle mistyping -> as => in function return type
Diffstat (limited to 'compiler/rustc_parse/src/parser/path.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 17e5bcf7605..311a4829fcf 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -1,4 +1,4 @@ -use super::ty::{AllowPlus, RecoverQPath}; +use super::ty::{AllowPlus, RecoverFatArrow, RecoverQPath}; use super::{Parser, TokenType}; use crate::maybe_whole; use rustc_ast::ptr::P; @@ -231,7 +231,8 @@ impl<'a> Parser<'a> { // `(T, U) -> R` let (inputs, _) = self.parse_paren_comma_seq(|p| p.parse_ty())?; let span = ident.span.to(self.prev_token.span); - let output = self.parse_ret_ty(AllowPlus::No, RecoverQPath::No)?; + let output = + self.parse_ret_ty(AllowPlus::No, RecoverQPath::No, RecoverFatArrow::No)?; ParenthesizedArgs { inputs, output, span }.into() }; |
