diff options
author | Tage Johansson <frans.tage@gmail.com> | 2023-03-04 19:43:02 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:21:10 +0100 |
commit | ef24a5b55876c38c73d8d8813df230b515936466 (patch) | |
tree | 40e8be445db44f0b280c2203a27f29221669a555 /gcc/rust/backend/rust-compile-expr.cc | |
parent | 8511a6f5cee5b2b08510a608a89f74098ecfec01 (diff) | |
download | gcc-ef24a5b55876c38c73d8d8813df230b515936466.zip gcc-ef24a5b55876c38c73d8d8813df230b515936466.tar.gz gcc-ef24a5b55876c38c73d8d8813df230b515936466.tar.bz2 |
gccrs: Add all rust keywords (except priv) to the follow-set of `:vis` when parsing macro rules
Previously, the following macro rules were rejected by gccrs:
```Rust
macro_rules! {
($v:vis <KEY_WORD>) => { ... };
}
```
This PR fixes so the above code is accepted by the compiler for all key words like `async` or `unsafe`.
The only exception is the keyword `priv` which is not allowed.
See [this page](https://doc.rust-lang.org/reference/macro-ambiguity.html) for reference. Especially the following excerpt:
> FOLLOW(vis) = {,l any keyword or identifier except a non-raw priv; any token that can begin a type; ident, ty, and path nonterminals}.
Fixes #1060
gcc/rust/ChangeLog:
* parse/rust-parse.cc: fix follow-sets
gcc/testsuite/ChangeLog:
* rust/compile/macro47.rs: Test that :vis can be followed by some keywords
* rust/compile/macro48.rs: Test that :vis cannot be followed by the keyword priv
Signed-off-by: Tage Johansson <frans.tage@gmail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
0 files changed, 0 insertions, 0 deletions