diff options
| author | bors <bors@rust-lang.org> | 2020-02-13 09:42:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-13 09:42:10 +0000 |
| commit | be493fe8cc40c3d3f6030a1313c1ff747fce770d (patch) | |
| tree | f5f5389477017c943087b76cdbec10c1a58b5b53 /src/test/codegen/src-hash-algorithm | |
| parent | 2e6eaceedeeda764056eb0e2134735793533770d (diff) | |
| parent | 9828559aad8672bb320517bd0fa1992ce144b848 (diff) | |
| download | rust-be493fe8cc40c3d3f6030a1313c1ff747fce770d.tar.gz rust-be493fe8cc40c3d3f6030a1313c1ff747fce770d.zip | |
Auto merge of #69023 - Centril:parse_fn, r=petrochenkov
parse: unify function front matter parsing
Part of https://github.com/rust-lang/rust/pull/68728.
- `const extern fn` feature gating is now done post-expansion such that we do not have conditional compatibilities of function qualifiers *in parsing*.
- The `FnFrontMatter` grammar becomes:
```rust
Extern = "extern" StringLit ;
FnQual = "const"? "async"? "unsafe"? Extern? ;
FnFrontMatter = FnQual "fn" ;
```
That is, all item contexts now *syntactically* allow `const async unsafe extern "C" fn` and use semantic restrictions to rule out combinations previously prevented syntactically. The semantic restrictions include in particular:
- `fn`s in `extern { ... }` can have no qualifiers.
- `const` and `async` cannot be combined.
- We change `ast::{Unsafety, Spanned<Constness>}>` into `enum ast::{Unsafe, Const} { Yes(Span), No }` respectively. This change in formulation allow us to exclude `Span` in the case of `No`, which facilitates parsing. Moreover, we also add a `Span` to `IsAsync` which is renamed to `Async`. The new `Span`s in `Unsafety` and `Async` are then taken advantage of for better diagnostics. A reason this change was made is to have a more uniform and clear naming scheme.
The HIR keeps the structures in AST (with those definitions moved into HIR) for now to avoid regressing perf.
r? @petrochenkov
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions
