diff options
author | Tage Johansson <frans.tage@gmail.com> | 2023-03-04 19:43:02 +0100 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-03-16 10:19:16 +0000 |
commit | 0e010fc08b42cf4379e2ad1b51518c22a7f82186 (patch) | |
tree | 7a10cd3d564b6fd55a20eab18b4ddfcbf3e908f8 /gcc/rust/backend/rust-compile.cc | |
parent | ae80bcdd9b3bb8ace429804dd0f493d9f31b7c29 (diff) | |
download | gcc-0e010fc08b42cf4379e2ad1b51518c22a7f82186.zip gcc-0e010fc08b42cf4379e2ad1b51518c22a7f82186.tar.gz gcc-0e010fc08b42cf4379e2ad1b51518c22a7f82186.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.cc')
0 files changed, 0 insertions, 0 deletions