]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: proc macro: Add help message to malformed derive
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 18 Jul 2023 12:38:58 +0000 (14:38 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:55:57 +0000 (18:55 +0100)
Add an help message in case of malformed proc_macro_derive declaration.

gcc/rust/ChangeLog:

* util/rust-attributes.cc (AttributeChecker::visit): Add help
message.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/util/rust-attributes.cc

index c8451def94ebef279aea33e1c0b8d7b1652e13ca..3ee7f2b6f0c5baf4348a7aab9f16b76b789c4eae 100644 (file)
@@ -565,6 +565,10 @@ AttributeChecker::visit (AST::Function &fun)
            {
              rust_error_at (attribute.get_locus (),
                             "malformed %<%s%> attribute input", name);
+             rust_inform (
+               attribute.get_locus (),
+               "must be of the form: %<#[proc_macro_derive(TraitName, "
+               "/*opt*/ attributes(name1, name2, ...))]%>");
            }
          check_crate_type (name, attribute);
        }