diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-07-18 13:37:03 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:55:57 +0100 |
commit | 1b1f8d898857b69b98095fc26b4dd95bafffdc18 (patch) | |
tree | e21530e2ea616c76b84d0674f29278650347a9cf | |
parent | 6bed91c311e0fbfc72ad4de605335900fc98a5e6 (diff) | |
download | gcc-1b1f8d898857b69b98095fc26b4dd95bafffdc18.zip gcc-1b1f8d898857b69b98095fc26b4dd95bafffdc18.tar.gz gcc-1b1f8d898857b69b98095fc26b4dd95bafffdc18.tar.bz2 |
gccrs: 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 a174edc..c8451de 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" |