Skip to content

Commit

Permalink
Parse block expr as verbatim in non-full mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 2, 2023
1 parent 31e4119 commit 5325bb6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,16 @@ pub(crate) mod parsing {
} else if input.is_empty() {
Err(input.error("expected an expression"))
} else {
if input.peek(token::Brace) {
let scan = input.fork();
let content;
braced!(content in scan);
if content.parse::<Expr>().is_ok() && content.is_empty() {
let expr_block = verbatim::between(input, &scan);
input.advance_to(&scan);
return Ok(Expr::Verbatim(expr_block));
}
}
Err(input.error("unsupported expression; enable syn's features=[\"full\"]"))
}
}
Expand Down

0 comments on commit 5325bb6

Please sign in to comment.