public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7665] gccrs: expand: Make to_derive argument const
@ 2024-01-16 17:51 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 17:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d41160ca9747e085e28130c38ec04804082a45e2

commit r14-7665-gd41160ca9747e085e28130c38ec04804082a45e2
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Wed Jun 7 12:43:07 2023 +0200

    gccrs: expand: Make to_derive argument const
    
    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>

Diff:
---
 gcc/rust/expand/rust-expand-visitor.cc | 2 +-
 gcc/rust/expand/rust-macro-expand.h    | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/expand/rust-expand-visitor.cc b/gcc/rust/expand/rust-expand-visitor.cc
index c7a5f573d7e..3601287be99 100644
--- a/gcc/rust/expand/rust-expand-visitor.cc
+++ b/gcc/rust/expand/rust-expand-visitor.cc
@@ -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;
diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h
index 0e53913438a..8ac84d513b2 100644
--- a/gcc/rust/expand/rust-macro-expand.h
+++ b/gcc/rust/expand/rust-macro-expand.h
@@ -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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 17:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 17:51 [gcc r14-7665] gccrs: expand: Make to_derive argument const Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).