[COMMITTED 12/77] gccrs: Rename error type
[email protected] Fri, 7 Aug 2026 14:39:03 +0200
Newsgroups
gmane.comp.gcc.rust,gmane.comp.gcc.patches
Message-ID
<[email protected] >
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] >
---
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 bb873f3204a..011ca8b99e8 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 620a14f8ec3..930012a7bd7 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.50.1