rust/src/librustc_parse
Aaron Hill f63b88c761
Permit attributes on 'if' expressions
Previously, attributes on 'if' expressions (e.g. #[attr] if true {})
were disallowed during parsing. This made it impossible for macros to
perform any custom handling of such attributes (e.g. stripping them
away), since a compilation error would be emitted before they ever had a
chance to run.

This PR permits attributes on 'if' expressions ('if-attrs' from here on).
Both built-in attributes (e.g. `#[allow]`, `#[cfg]`) are supported.

We still do *not* accept attributes on 'other parts' of an if-else
chain. That is, the following code snippet still fails to parse:

```rust
if true {} #[attr] else if false {} else #[attr] if false {} #[attr]
else {}
```
2020-03-04 16:43:13 -05:00
..
lexer Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
parser Permit attributes on 'if' expressions 2020-03-04 16:43:13 -05:00
Cargo.toml Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
config.rs Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
lib.rs Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00
validate_attr.rs Rename syntax to rustc_ast in source code 2020-02-29 21:59:09 +03:00