From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/syn/src/expr.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'vendor/syn/src/expr.rs') diff --git a/vendor/syn/src/expr.rs b/vendor/syn/src/expr.rs index cf0fa0af9..93a59b0e2 100644 --- a/vendor/syn/src/expr.rs +++ b/vendor/syn/src/expr.rs @@ -1371,7 +1371,9 @@ pub(crate) mod parsing { }); } else if Precedence::Cast >= base && input.peek(Token![as]) { let as_token: Token![as] = input.parse()?; - let ty = input.call(Type::without_plus)?; + let allow_plus = false; + let allow_group_generic = false; + let ty = ty::parsing::ambig_ty(input, allow_plus, allow_group_generic)?; check_cast(input)?; lhs = Expr::Cast(ExprCast { attrs: Vec::new(), @@ -1381,7 +1383,9 @@ pub(crate) mod parsing { }); } else if Precedence::Cast >= base && input.peek(Token![:]) && !input.peek(Token![::]) { let colon_token: Token![:] = input.parse()?; - let ty = input.call(Type::without_plus)?; + let allow_plus = false; + let allow_group_generic = false; + let ty = ty::parsing::ambig_ty(input, allow_plus, allow_group_generic)?; check_cast(input)?; lhs = Expr::Type(ExprType { attrs: Vec::new(), @@ -1429,7 +1433,9 @@ pub(crate) mod parsing { }); } else if Precedence::Cast >= base && input.peek(Token![as]) { let as_token: Token![as] = input.parse()?; - let ty = input.call(Type::without_plus)?; + let allow_plus = false; + let allow_group_generic = false; + let ty = ty::parsing::ambig_ty(input, allow_plus, allow_group_generic)?; check_cast(input)?; lhs = Expr::Cast(ExprCast { attrs: Vec::new(), @@ -1727,7 +1733,10 @@ pub(crate) mod parsing { || input.peek(Token![move]) { expr_closure(input, allow_struct).map(Expr::Closure) - } else if input.peek(Token![for]) && input.peek2(Token![<]) && input.peek3(Lifetime) { + } else if input.peek(Token![for]) + && input.peek2(Token![<]) + && (input.peek3(Lifetime) || input.peek3(Token![>])) + { let begin = input.fork(); input.parse::()?; expr_closure(input, allow_struct)?; @@ -2010,7 +2019,9 @@ pub(crate) mod parsing { Expr::If(input.parse()?) } else if input.peek(Token![while]) { Expr::While(input.parse()?) - } else if input.peek(Token![for]) { + } else if input.peek(Token![for]) + && !(input.peek2(Token![<]) && (input.peek3(Lifetime) || input.peek3(Token![>]))) + { Expr::ForLoop(input.parse()?) } else if input.peek(Token![loop]) { Expr::Loop(input.parse()?) -- cgit v1.2.3