Implement std::fs::canonicalize for WASI #141854
Labels
A-filesystem
Area: `std::fs`
O-wasi
Operating system: Wasi, Webassembly System Interface
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
std::fs::canonicalize()
is not implemented for WASI, but I can't see any show-stopping reason why it couldn't be (maybe pre-opens complicate it?). I ran into this when attempting to compile rustfmt for WASI.I found a couple of related issues:
1
#82339 - suggests using the
Prefix
part of paths (likeC:
) for pre-opens.@RReverser said
This is exactly the situation I ran into. I'll also note that this was quite annoying to debug since the error message in its entirety was
operation not supported on this platform
, you can't useRUST_BACKTRACE
, rustfmt doesn't have extensive logging, and I don't fancy setting up WASM debugging. I resorted to tedious printf debugging. (Side rant: for all the emphasis Rust puts on compiler error messages its runtime error messages are usually quite terrible!)2
This issue in Rollup where they ran into the same problem and have a simple implementation we could maybe use.
The text was updated successfully, but these errors were encountered: