Skip to content

Commit

Permalink
Merge pull request #1013 from dtolnay/exprparse
Browse files Browse the repository at this point in the history
impl Parse for ExprContinue
  • Loading branch information
dtolnay authored Apr 1, 2021
2 parents e6c934a + 845b086 commit fe690b3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,7 @@ pub(crate) mod parsing {
} else if input.peek(Token![break]) {
expr_break(input, allow_struct).map(Expr::Break)
} else if input.peek(Token![continue]) {
input.call(expr_continue).map(Expr::Continue)
input.parse().map(Expr::Continue)
} else if input.peek(Token![return]) {
expr_ret(input, allow_struct).map(Expr::Return)
} else if input.peek(token::Bracket) {
Expand Down Expand Up @@ -2246,7 +2246,6 @@ pub(crate) mod parsing {
ExprField, Field, "expected struct field access",
ExprIndex, Index, "expected indexing expression",
ExprRange, Range, "expected range expression",
ExprContinue, Continue, "expected continue expression",
ExprReturn, Return, "expected return expression",
ExprTry, Try, "expected try expression",
ExprYield, Yield, "expected yield expression",
Expand Down Expand Up @@ -2515,12 +2514,15 @@ pub(crate) mod parsing {
}

#[cfg(feature = "full")]
fn expr_continue(input: ParseStream) -> Result<ExprContinue> {
Ok(ExprContinue {
attrs: Vec::new(),
continue_token: input.parse()?,
label: input.parse()?,
})
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for ExprContinue {
fn parse(input: ParseStream) -> Result<Self> {
Ok(ExprContinue {
attrs: Vec::new(),
continue_token: input.parse()?,
label: input.parse()?,
})
}
}

#[cfg(feature = "full")]
Expand Down

0 comments on commit fe690b3

Please sign in to comment.