alexcrichton opened PR #15359 from alexcrichton:remove-second-platform-module to bytecodealliance:main:
Prior to the vendoring of cap-primitives the wasmtime-wasi crate already had windows/unix-specific modules. With the vendoring of cap-primitives there was then two different locations for platform-specific modules, and this commit is a stab at resolving this semi-duplication and consolidating into just one platform-specific module.
The changes here are somewhat involved as this is additionally attempting to further remove layers of abstraction between the
filesystem.rsinterface and whatprimitivesprovides. Previously everything infilesystem.rswas centered around the API and capabilities of thecap-stdcrate (andcap-primitives), but such constraints are generally no longer necessary and it's possible to massage APIs to exactly what WASI needs for example.This shuffles around the definition of
MetadataandFileType, for example, as thestdequivalents are no longer ever used. This is due to the myriad of entrypoints that this information can be learned and there being no public constructor instditself. This means that somestd-like paths are now mirrored in wasmtime-wasi, but mostly for the Windows side of things as the Unix side already had to have this duplication. The Unix side is simpler now that the standard library is no longer used and the source of truth of metadata information is eitherstatorstatxstructures fromrustix.Part of the simplification here is additionally related to symlinks. WASI only has a single symlink function, so the
symlink_{file,dir}functions are consolidated into just the Windows implementation where that's relevant. This additionally has a minor change in behavior where dangling symlinks are now allowed on Windows and are assumed to besymlink_fileequivalents. Previously dangling symlinks always generated an error because the code use?when learning about the symlink target to determine what kind of symlink to create. Arguably this is a wasi:filesystem issue as the semantics of how to implement a cross-platform baresymlinkfunction is not entirely clear. It's hoped that the precise semantics here aren't going to cause issues.Regardless though the end result is that all platform-specific code is now in a single location for filesystem handling, and there's a reduction of the back-and-forth of which abstraction layer you're at.
<!--
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 review the Bytecode Alliance's AI tool usage policy at
https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.mdPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton removed the review request for wasmtime-wasi-reviewers from PR #15359.
alexcrichton requested rvolosatovs for a review on PR #15359.
alexcrichton requested wasmtime-wasi-reviewers for a review on PR #15359.
pchickey requested pchickey for a review on PR #15359.
github-actions[bot] added the label wasi on PR #15359.
alexcrichton requested wasmtime-core-reviewers for a review on PR #15359.
alexcrichton updated PR #15359.
Last updated: Nov 19 2026 at 20:05 UTC