Repository navigation
Emit mod.rs as the Rust receiver bindings root instead of lib.rs - #6593
Merged
Shubham8287 merged 1 commit intoNov 16, 2026
Merged
Shubham8287 merged 1 commit into
Shubham8287 merged 1 commit into
Conversation
`spacetime generate --bindings module --lang rust` without a spacetime.json dependency wrote the bindings root as lib.rs. A sender loads the bindings with `mod remote_bindings;`, which only finds remote_bindings.rs or remote_bindings/mod.rs, so the output could not be used without a manual #[path]. Only the dependency path renamed the file to mod.rs. The root is never a crate root: its outbox macros are `pub(crate)` and only resolve inside the sender crate. Codegen now emits mod.rs directly, and the CLI no longer special-cases lib.rs. Rename the idc_receiver test fixture to mod.rs and update the tests and snapshots that expected lib.rs.
Contributor
Author
|
Hey @Shubham8287, @joshua-spacetime this follows up on the Rust receiver bindings from #6375: without a spacetime.json dependency, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Rust receiver (IDC) bindings generated with
spacetime generate --bindings module --lang rust, without adependenciesentry inspacetime.json, writes its root file aslib.rs. A sender loads the bindings withmod remote_bindings;, which only findsremote_bindings.rsorremote_bindings/mod.rs, so the output could not be used without a manual#[path].Only the
spacetime.jsondependency path renamed the root to{dependency}/mod.rs. The root is never a crate root: its outbox macros arepub(crate)and are called through the receiver module path byoutbox!and#[table(outbox(...))], so they only resolve inside the sender crate.mod.rsas the root, matching Rust client bindings.lib.rswhen placing dependency bindings.idc_receivertest fixture is renamed tomod.rs.API and ABI breaking changes
No API or ABI changes. The generated file name changes from
lib.rstomod.rsforspacetime generate --bindings modulewithout aspacetime.jsondependency. Projects that load that output through#[path = ".../lib.rs"]need to update the path after regenerating. Bindings generated fromspacetime.jsondependencies are unchanged.Rollback safety impact
n/a
Expected complexity level and risk
1
Testing
Updated:
mod.rs.module-test, and the codegen fixture comparison to load the renamedidc_receiver/mod.rsfixture.lib.rstomod.rs.cli_generate_rust_module_bindingssmoketest, which runsspacetime generate --bindings modulewithout aspacetime.jsondependency, to check that the output containsmod.rsand nolib.rs.Existing smoketests generate bindings from
spacetime.jsondependencies, compile a sender that uses them, and deliver IDC calls between two Rust modules. They cover the dependency path, which still produces{dependency}/mod.rs.I build the binary and tested it locally with my project that ran into that issue. It successfully generated a mod.rs file.