diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-07-18 13:37:03 +0200 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2023-07-20 08:21:00 +0000 |
commit | d6912fb38b96b3989cd009bde1c36e659e0bdd70 (patch) | |
tree | d46d4fea3e21379e8f6943a7314cd44cc9e6077b | |
parent | f715169a6ec1b504354e0fc3e2a46bbf29d8715c (diff) | |
download | gcc-d6912fb38b96b3989cd009bde1c36e659e0bdd70.zip gcc-d6912fb38b96b3989cd009bde1c36e659e0bdd70.tar.gz gcc-d6912fb38b96b3989cd009bde1c36e659e0bdd70.tar.bz2 |
proc macro: Detect malformed proc_macro_derive
A derive procedural macro declaration shall always have at least a trait
to refer to. We should error out when it doesn't.
gcc/rust/ChangeLog:
* util/rust-attributes.cc (AttributeChecker::visit): Add
attribute input check.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/util/rust-attributes.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc index e5670f9..1d2907b 100644 --- a/gcc/rust/util/rust-attributes.cc +++ b/gcc/rust/util/rust-attributes.cc @@ -561,6 +561,11 @@ AttributeChecker::visit (AST::Function &fun) if (result.name == "proc_macro_derive") { + if (!attribute.has_attr_input ()) + { + rust_error_at (attribute.get_locus (), + "malformed %<%s%> attribute input", name); + } check_crate_type (name, attribute); } else if (result.name == "proc_macro" |