rust/src/librustc_parse
Mazdak Farrokhzad 9674c09ae9
Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank
Improve expression & attribute parsing

This PR includes misc improvements to expression and attribute parsing.

1. Some code simplifications
2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.)
3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.)
4. ^--- These are done so that code sharing in block parsing is increased.
5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.)
6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.)
7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.)
8. Simplified attribute parsing code & slightly improved diagnostics.
9. Added recovery for e.g., `Box<('a) + Trait>`.
10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`.

r? @estebank
2020-03-11 14:03:45 +01:00
..
lexer On mismatched delimiters, only point at empty blocks that are in the same line 2020-03-04 11:05:17 -08:00
parser Rollup merge of #69760 - Centril:parse-expr-improve, r=estebank 2020-03-11 14:03:45 +01:00
Cargo.toml Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
config.rs fix various typos 2020-03-06 15:19:31 +01:00
lib.rs parse_if_expr: recover on attributes 2020-03-10 08:55:18 +01:00
validate_attr.rs Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00