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

gcc/rust/ChangeLog:

        * rust-session-manager.cc (Session::dump_hir_pretty): Update error type
        name.
        (Session::load_extern_crate): Likewise.
        * rust-session-manager.h: Change error type name.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/f910405bbb536b83a88c7fc8ca8f311df08b94e6

The commit has NOT been mentioned in any issue.

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4588

 gcc/rust/rust-session-manager.cc | 11 +++++------
 gcc/rust/rust-session-manager.h  | 16 ++++++++--------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc
index bb873f320..011ca8b99 100644
--- a/gcc/rust/rust-session-manager.cc
+++ b/gcc/rust/rust-session-manager.cc
@@ -1240,7 +1240,7 @@ Session::dump_hir_pretty (HIR::Crate &crate) const
 
 // imports
 
-tl::expected<Session::LoadedCrate, Session::AlreadyLoadedError>
+tl::expected<Session::LoadedCrate, Session::LoadingError>
 Session::load_extern_crate (const std::string &crate_name, location_t locus)
 {
   // has it already been loaded?
@@ -1250,7 +1250,7 @@ Session::load_extern_crate (const std::string 
&crate_name, location_t locus)
       rust_assert (resolved_node_id);
 
       return tl::make_unexpected (
-       AlreadyLoadedError::make_already_loaded (*resolved_node_id));
+       LoadingError::make_already_loaded (*resolved_node_id));
     }
 
   std::string relative_import_path = "";
@@ -1280,7 +1280,7 @@ Session::load_extern_crate (const std::string 
&crate_name, location_t locus)
       && proc_macros.empty ()) // no proc macros
     {
       rust_error_at (locus, "failed to locate crate %qs", import_name.c_str 
());
-      return tl::make_unexpected (AlreadyLoadedError::make_failed_to_locate 
());
+      return tl::make_unexpected (LoadingError::make_failed_to_locate ());
     }
 
   auto extern_crate
@@ -1294,8 +1294,7 @@ Session::load_extern_crate (const std::string 
&crate_name, location_t locus)
       if (!ok)
        {
          rust_error_at (locus, "failed to load crate metadata");
-         return tl::make_unexpected (
-           AlreadyLoadedError::make_failed_to_locate ());
+         return tl::make_unexpected (LoadingError::make_failed_to_locate ());
        }
     }
 
@@ -1305,7 +1304,7 @@ Session::load_extern_crate (const std::string 
&crate_name, location_t locus)
     {
       rust_error_at (locus, "current crate name %qs collides with this",
                     current_crate_name.c_str ());
-      return tl::make_unexpected (AlreadyLoadedError::make_collision ());
+      return tl::make_unexpected (LoadingError::make_collision ());
     }
 
   // setup mappings
diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h
index 620a14f8e..930012a7b 100644
--- a/gcc/rust/rust-session-manager.h
+++ b/gcc/rust/rust-session-manager.h
@@ -444,7 +444,7 @@ public:
     Resolver2_0::NameResolutionContext ctx;
   };
 
-  struct AlreadyLoadedError
+  struct LoadingError
   {
   public:
     enum class Kind
@@ -454,24 +454,24 @@ public:
       COLLISION,
     } kind;
 
-    static AlreadyLoadedError make_already_loaded (NodeId node_id)
+    static LoadingError make_already_loaded (NodeId node_id)
     {
-      return AlreadyLoadedError{Kind::ALREADY_LOADED, node_id};
+      return LoadingError{Kind::ALREADY_LOADED, node_id};
     }
 
-    static AlreadyLoadedError make_failed_to_locate ()
+    static LoadingError make_failed_to_locate ()
     {
-      return AlreadyLoadedError{Kind::FAILED_TO_LOCATE, UNKNOWN_NODEID};
+      return LoadingError{Kind::FAILED_TO_LOCATE, UNKNOWN_NODEID};
     }
 
-    static AlreadyLoadedError make_collision ()
+    static LoadingError make_collision ()
     {
-      return AlreadyLoadedError{Kind::COLLISION, UNKNOWN_NODEID};
+      return LoadingError{Kind::COLLISION, UNKNOWN_NODEID};
     }
     NodeId node_id;
   };
 
-  tl::expected<LoadedCrate, AlreadyLoadedError>
+  tl::expected<LoadedCrate, LoadingError>
   load_extern_crate (const std::string &crate_name, location_t locus);
 
 private:
-- 
2.54.0

Reply via email to