diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-11-08 10:57:48 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:13:13 +0100 |
commit | 8f41baaa832a480338b7a4d686d4b26000164588 (patch) | |
tree | c9ec9a5b033a72f424ba2b1a9276afc87b51b5be /gcc | |
parent | 0344e23236c8e28b80ce1b14a3a4394918953f2e (diff) | |
download | gcc-8f41baaa832a480338b7a4d686d4b26000164588.zip gcc-8f41baaa832a480338b7a4d686d4b26000164588.tar.gz gcc-8f41baaa832a480338b7a4d686d4b26000164588.tar.bz2 |
gccrs: Replace local keyword set with the utils
We don't require that local set anymore.
gcc/rust/ChangeLog:
* checks/errors/rust-ast-validation.cc (RS_TOKEN): Remove locale set.
(RS_TOKEN_KEYWORD): Likewise.
(ASTValidation::visit): Change keyword set call to the one from utils.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/checks/errors/rust-ast-validation.cc | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc index d27d3e8..3af5655 100644 --- a/gcc/rust/checks/errors/rust-ast-validation.cc +++ b/gcc/rust/checks/errors/rust-ast-validation.cc @@ -18,25 +18,17 @@ #include "rust-ast-validation.h" #include "rust-diagnostics.h" +#include "rust-keyword-values.h" namespace Rust { -namespace { -// TODO: make constexpr when update to c++20 -const std::map<std::string, TokenId> keywords = { -#define RS_TOKEN(x, y) -#define RS_TOKEN_KEYWORD(tok, key) {key, tok}, - RS_TOKEN_LIST -#undef RS_TOKEN_KEYWORD -#undef RS_TOKEN -}; -} // namespace - void ASTValidation::visit (AST::Lifetime &lifetime) { auto name = lifetime.get_lifetime_name (); auto valid = std::set<std::string>{"static", "_"}; + auto &keywords = Values::Keywords::keywords; + if (valid.find (name) == valid.end () && keywords.find (name) != keywords.end ()) rust_error_at (lifetime.get_locus (), "lifetimes cannot use keyword names"); |