From: Pierre-Emmanuel Patry <[email protected]>

gcc/rust/ChangeLog:

        * rust-session-manager.cc (Session::handle_crate_name): Use the new
        constexpr instead of a raw string value.
        * util/rust-attribute-values.h: Add crate_name and crate_type values.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
 gcc/rust/rust-session-manager.cc      | 2 +-
 gcc/rust/util/rust-attribute-values.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index cf3237ccd71..a74b99754b8 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -476,7 +476,7 @@ Session::handle_crate_name (const char *filename,
 
   for (const auto &attr : parsed_crate.inner_attrs)
     {
-      if (attr.get_path () != "crate_name")
+      if (attr.get_path () != Values::Attributes::CRATE_NAME)
        continue;
 
       auto msg_str = Analysis::Attributes::extract_string_literal (attr);
diff --git a/gcc/rust/util/rust-attribute-values.h 
b/gcc/rust/util/rust-attribute-values.h
index 34e938025b8..f4146b8802a 100644
--- a/gcc/rust/util/rust-attribute-values.h
+++ b/gcc/rust/util/rust-attribute-values.h
@@ -50,6 +50,8 @@ public:
   static constexpr auto &PROC_MACRO = "proc_macro";
   static constexpr auto &PROC_MACRO_DERIVE = "proc_macro_derive";
   static constexpr auto &PROC_MACRO_ATTRIBUTE = "proc_macro_attribute";
+  static constexpr auto &CRATE_NAME = "crate_name";
+  static constexpr auto &CRATE_TYPE = "crate_type";
 
   static constexpr auto &TARGET_FEATURE = "target_feature";
   static constexpr auto &FEATURE = "feature";
-- 
2.50.1

Reply via email to