]> gcc.gnu.org Git - gcc.git/commitdiff
gccrs: expand: Make to_derive argument const
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 7 Jun 2023 10:43:07 +0000 (12:43 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:27 +0000 (18:46 +0100)
This string will never change and can be constified.

gcc/rust/ChangeLog:

* expand/rust-expand-visitor.cc (derive_item): Add const
attribute to the trait name argument.
* expand/rust-macro-expand.h (struct MacroExpander): Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/expand/rust-expand-visitor.cc
gcc/rust/expand/rust-macro-expand.h

index c7a5f573d7edfa89389a78cdd407d5cdb6d7b54c..3601287be9963423c0eeef0e939487be09d6cead 100644 (file)
@@ -104,7 +104,7 @@ builtin_derive_item (std::unique_ptr<AST::Item> &item,
 }
 
 static std::vector<std::unique_ptr<AST::Item>>
-derive_item (std::unique_ptr<AST::Item> &item, std::string &to_derive,
+derive_item (std::unique_ptr<AST::Item> &item, const std::string &to_derive,
             MacroExpander &expander)
 {
   std::vector<std::unique_ptr<AST::Item>> result;
index 0e53913438a79a933594d3115595b285b1c94d9c..8ac84d513b2bd05d8310704d0183ce61ad794470 100644 (file)
@@ -340,7 +340,8 @@ struct MacroExpander
   void import_proc_macros (std::string extern_crate);
 
   template <typename T>
-  AST::Fragment expand_derive_proc_macro (T &item, std::string &trait_name)
+  AST::Fragment expand_derive_proc_macro (T &item,
+                                         const std::string &trait_name)
   {
     ProcMacro::CustomDerive macro;
 
This page took 0.076521 seconds and 5 git commands to generate.