[gcc r17-3107] gccrs: Define constructor for LoadedCrate struct

Arthur Cohen via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:cccd9fca61c7a73a1d6017c38d8567581cf30370

commit r17-3107-gcccd9fca61c7a73a1d6017c38d8567581cf30370
Author: Yap Zhi Heng <[email protected]>
Date:   Wed Jul 15 20:10:44 2026 +0800

    gccrs: Define constructor for LoadedCrate struct
    
    Aggregate initialization does not compile properly for LoadedCrate in C++20.
    
    gcc/rust/ChangeLog:
    
            * rust-session-manager.h (Session::LoadedCrate): Add explicit constructor.
    
    Signed-off-by: Yap Zhi Heng <[email protected]>

Diff:
---
 gcc/rust/rust-session-manager.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/rust/rust-session-manager.h b/gcc/rust/rust-session-manager.h
index af5a700b84b3..0a6cc8117dfc 100644
--- a/gcc/rust/rust-session-manager.h
+++ b/gcc/rust/rust-session-manager.h
@@ -461,6 +461,11 @@ public:
 
   struct LoadedCrate
   {
+    LoadedCrate (std::string name, NodeId node_id,
+		 Resolver2_0::NameResolutionContext ctx)
+      : name (std::move (name)), node_id (node_id), ctx (std::move (ctx))
+    {}
+
     LoadedCrate (const LoadedCrate &) = delete;
     LoadedCrate &operator= (const LoadedCrate &) = delete;
     LoadedCrate (LoadedCrate &&other) = default;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.