public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-7665] gccrs: expand: Make to_derive argument const
Date: Tue, 16 Jan 2024 17:51:54 +0000 (GMT)	[thread overview]
Message-ID: <20240116175154.59E5B3858425@sourceware.org> (raw)

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;

                 reply	other threads:[~2024-01-16 17:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116175154.59E5B3858425@sourceware.org \
    --to=cohenarthur@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).