alexcrichton opened PR #13872 from alexcrichton:cap-primitives-migration to bytecodealliance:main:
This commit is an attempt to reduce the number of layers of abstraction that we have for the
wasmtime-wasicrate and implementation, in particular around the dependencies that we have. Historicallywasmtime-wasihas primarily depended oncap-stdwhich provides astd-like API for using the native filesystem and other features (e.g. networking). Over time networking has largely moved away fromcap-std, however. I've additionally historically found it difficult to trace through the tree of dependencies for figuring out what a WASI call does. This requires following code inwasmtime-wasi, tocap-std, tocap-*-extsometimes, tocap-primitives, then torustix. The goal of this commit is to shorten this chain and instead primarily rely on the "meat" ofcap-std, thecap-primitivescrate.The
cap-stdcrate additionally serves a bit of a dual purpose of providing filesystem sandboxing and abstracting the underlying platform. This abstraction though is a bit leaky where the API is different enough across platforms that it can come at a performance cost on some platforms while also still needing#[cfg]s on others. This commit additionally is intended to reduce the reliance on this portability layer since the API that we're implementing, WASI, is the definition of what we want portability-wise which doesn't always match whatcap-stddoes.Overall this commit removes the
cap-stdandio-lifetimesdependencies from the Wasmtime workspace itself. A dependency is left oncap-fs-extout of necessity but it's only to access an otherwise-private API located in thecap-primitivescrate. Implementations throughoutwasmtime-wasihave shifted to using theirstdcounterparts (e.g. clocks), encapsulating more platform-specific logic (e.g. unix-vs-windows filesystem behavior), and refactoring to avoid dependencies (e.g. networking).This commit is not intended to introduce any new behavior nor change any preexisting behavior. The goal of this commit is to reduce the dependency tree of Wasmtime to the bare minimum necessary through the
cap-primitivescrate.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested dicej for a review on PR #13872.
alexcrichton requested wasmtime-wasi-reviewers for a review on PR #13872.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13872.
alexcrichton requested wasmtime-default-reviewers for a review on PR #13872.
alexcrichton updated PR #13872.
github-actions[bot] added the label wasmtime:c-api on PR #13872.
github-actions[bot] added the label wasi on PR #13872.
:thumbs_up: pchickey submitted PR review.
alexcrichton added PR #13872 Reduce dependencies on cap-std-family crates to the merge queue.
:check: alexcrichton merged PR #13872.
alexcrichton removed PR #13872 Reduce dependencies on cap-std-family crates from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC