summaryrefslogtreecommitdiffstats
path: root/vendor/syn/src/expr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/syn/src/expr.rs')
-rw-r--r--vendor/syn/src/expr.rs21
1 files changed, 16 insertions, 5 deletions
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::<BoundLifetimes>()?;
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()?)