From d41160ca9747e085e28130c38ec04804082a45e2 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 7 Jun 2023 12:43:07 +0200 Subject: [PATCH] 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 --- 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 c7a5f573d7ed..3601287be996 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 &item, } static std::vector> -derive_item (std::unique_ptr &item, std::string &to_derive, +derive_item (std::unique_ptr &item, const std::string &to_derive, MacroExpander &expander) { std::vector> result; diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h index 0e53913438a7..8ac84d513b2b 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 - 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; -- 2.47.2