aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-06-07 12:43:07 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2023-06-08 14:32:36 +0200
commitedff04f5ddcacfb3ae8a00c5eaee8459415bb1c4 (patch)
tree2a06f57b5e54a6a510e50219a995fa68936d298d
parentb94c7a9748f51310b010a95009716c739be90484 (diff)
downloadgcc-edff04f5ddcacfb3ae8a00c5eaee8459415bb1c4.zip
gcc-edff04f5ddcacfb3ae8a00c5eaee8459415bb1c4.tar.gz
gcc-edff04f5ddcacfb3ae8a00c5eaee8459415bb1c4.tar.bz2
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>
-rw-r--r--gcc/rust/expand/rust-expand-visitor.cc2
-rw-r--r--gcc/rust/expand/rust-macro-expand.h3
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 c7a5f57..3601287 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 7c79c46..b495513 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;