|
1 |
| -use super::{Parser, PathStyle, SeqSep, TokenType, Trailing}; |
| 1 | +use super::{ParseNtResult, Parser, PathStyle, SeqSep, TokenType, Trailing}; |
2 | 2 |
|
3 | 3 | use crate::errors::{
|
4 | 4 | self, DynAfterMut, ExpectedFnPathFoundFnKeyword, ExpectedMutOrConstInRawPointerType,
|
5 | 5 | FnPointerCannotBeAsync, FnPointerCannotBeConst, FnPtrWithGenerics, FnPtrWithGenericsSugg,
|
6 | 6 | HelpUseLatestEdition, InvalidDynKeyword, LifetimeAfterMut, NeedPlusAfterTraitObjectLifetime,
|
7 | 7 | NestedCVariadicType, ReturnTypesUseThinArrow,
|
8 | 8 | };
|
9 |
| -use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; |
| 9 | +use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_reparse_metavar_seq}; |
10 | 10 |
|
11 | 11 | use rustc_ast::ptr::P;
|
12 |
| -use rustc_ast::token::{self, Delimiter, Token, TokenKind}; |
| 12 | +use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind}; |
13 | 13 | use rustc_ast::util::case::Case;
|
14 | 14 | use rustc_ast::{
|
15 | 15 | self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, FnRetTy, GenericBound,
|
@@ -190,7 +190,8 @@ impl<'a> Parser<'a> {
|
190 | 190 | )
|
191 | 191 | }
|
192 | 192 |
|
193 |
| - /// Parse a type without recovering `:` as `->` to avoid breaking code such as `where fn() : for<'a>` |
| 193 | + /// Parse a type without recovering `:` as `->` to avoid breaking code such |
| 194 | + /// as `where fn() : for<'a>`. |
194 | 195 | pub(super) fn parse_ty_for_where_clause(&mut self) -> PResult<'a, P<Ty>> {
|
195 | 196 | self.parse_ty_common(
|
196 | 197 | AllowPlus::Yes,
|
@@ -250,7 +251,15 @@ impl<'a> Parser<'a> {
|
250 | 251 | ) -> PResult<'a, P<Ty>> {
|
251 | 252 | let allow_qpath_recovery = recover_qpath == RecoverQPath::Yes;
|
252 | 253 | maybe_recover_from_interpolated_ty_qpath!(self, allow_qpath_recovery);
|
253 |
| - maybe_whole!(self, NtTy, |ty| ty); |
| 254 | + if let Some(ty) = maybe_reparse_metavar_seq!( |
| 255 | + self, |
| 256 | + NonterminalKind::Ty, |
| 257 | + NonterminalKind::Ty, |
| 258 | + ParseNtResult::Ty(ty), |
| 259 | + ty |
| 260 | + ) { |
| 261 | + return Ok(ty); |
| 262 | + } |
254 | 263 |
|
255 | 264 | let lo = self.token.span;
|
256 | 265 | let mut impl_dyn_multi = false;
|
|
0 commit comments