[gcc r14-7807] gccrs: proc macro: Add help message to malformed derive

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:00:14 GMT 2024


https://gcc.gnu.org/g:9a99feab7cbc2dcb01c3af99dca4c2a4403d83b1

commit r14-7807-g9a99feab7cbc2dcb01c3af99dca4c2a4403d83b1
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Jul 18 14:38:58 2023 +0200

    gccrs: proc macro: Add help message to malformed derive
    
    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>

Diff:
---
 gcc/rust/util/rust-attributes.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc
index c8451def94e..3ee7f2b6f0c 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -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);
 	}


More information about the Gcc-cvs mailing list