Emit modules within metadata export file.
Ensures modules are included in gccrs metadata exports, allowing them to be resolved upon crate import.
This commit adds the emission of modules into the metadata export files generated by gccrs. Previously, modules were not included, which prevented them from being correctly resolved when another crate imported the current one. New functions in rust-export-metadata.cc now handle emitting the module preamble and suffix, ensuring module structure is preserved in the metadata.
In Details
GCC's Rust frontend now emits module information during metadata export. The ExportContext in rust-export-metadata.cc has been updated with begin_module and end_module functions to correctly serialize module structures. This change is necessary for metadata consumers to correctly resolve items within modules when importing a crate.
- metadata export
- The process of generating metadata about a Rust crate that can be used by other tools or crates, such as for linking or reflection.
- module
- A namespace in Rust that organizes code, defining visibility and scope for items like functions, structs, and enums.
- crate
- A compilation unit in Rust, typically a library or binary, defined by a
Cargo.tomlmanifest file.