Skip to main content

MEP-73 research bundle

This bundle is the informative companion to MEP-73. It documents the design space the bridge sits in: prior art, the choices considered and rejected, the trade-offs accepted, and the open risks. The bundle is meant to be read alongside the spec, not in place of it.

Notes

NoteSubject
01. Language surfaceThe import rust "..." import shape, the mochi.toml [rust-dependencies] + [rust] tables, the CLI surface (mochi pkg add rust, mochi pkg publish --to=crates.io), and the per-import alias semantics.
02. Design philosophyWhy a bidirectional bridge, why rustdoc JSON over alternatives, why a synthesised wrapper crate over direct FFI, why the async bridge sits on a tokio singleton, why Sigstore-keyless is the only publish path.
03. Prior-art bridgesPyO3, neon, napi-rs, uniffi, diplomat, swift-bridge, cxx, autocxx, wit-bindgen, JNI / JNR. What each gets right, what each requires the user to write, and what MEP-73 borrows.
04. Rustdoc JSON ingestThe rustdoc-types schema, the ItemEnum / Type discriminators, the stability story, why nightly is required at lock time, the Go-side parser shape.
05. Type mapping tableThe complete closed translation table, the refusal cases, the generic monomorphisation rule, the &str vs String parameter handling, the Option and Result desugar.
06. Cargo publish flowThe crates.io upload protocol, the per-package metadata requirements, the sparse-index format, the .crate tarball shape, the publish-side gate.
07. Sigstore and Cargo RFC #3724The OIDC token exchange, the Fulcio short-lived cert, the Rekor transparency log, the verification path at install time, the crates.io trusted-publishing GA timeline.
08. Async bridgeThe tokio runtime singleton, the current-thread vs multi-thread choice, the block_on cost, the cancellation semantics, the cross-runtime mismatch when a crate uses async-std.
09. ABI stabilityextern "C" guarantees, repr(C) requirements, opaque handle strategy for non-repr(C) types, the String and Vec round-trip, drop semantics across the wrapper boundary, the static link vs cdylib decision.
10. Lifetimes and ownershipHow the bridge translates &'a T, &'a mut T, Box<T>, Rc<T>, Arc<T> into Mochi's ownership-free surface; the borrow-to-clone strategy; the move-to-handle strategy; the lifetime erasure trade-off.
11. Embedded and no_stdThe no_std subset of crates.io, the alloc feature flag, the embedded MEP-53 target, what kind of Rust crates Mochi can consume on bare metal, the firmware story.
12. Risks and alternativesThe risk register (rustdoc stability, wrapper compile time, generic explosion, tokio cost, capability drift, GA timing) and the rejected alternatives (cbindgen primary, cxx, uniffi, diplomat, WIT-only, dlopen pre-built, lifetime translation, long-lived token, multi-thread default, per-build cargo).

Cross-references

  • MEP-73 spec — the normative document.
  • MEP-53 — the Rust transpiler this bridge builds on.
  • MEP-57 — the source-level package system whose manifest and lockfile the bridge extends.
  • Implementation tracking — the per-phase delivery status.