Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for WASI #205

Closed
wants to merge 1 commit into from
Closed

Conversation

Timmmm
Copy link

@Timmmm Timmmm commented Feb 20, 2025

Add the magic feature() code to allow compiling under wasip2, and expose ino and DirEntryExt.

Tested with cargo +nightly build --target wasm32-wasip2.

Add the magic `feature()` code to allow compiling under wasip2, and expose `ino` and `DirEntryExt`.
@BurntSushi
Copy link
Owner

I generally don't accept nightly-only stuff in crates I maintain. I've done it in the past for other crates, and I've generally regretted it due to it causing headaches in one form or another.

@Timmmm
Copy link
Author

Timmmm commented Feb 20, 2025

I don't really understand why this is nightly only tbh. Neither this page nor this one mention nightly once.

Is it possible to use WASI without nightly somehow?

Btw if you're curious about my motivation: I got fed up with pre-commit being hella janky due to Python so I'm working on an alternative that uses WASI for all of its linters. First one I've tried to get working is Ruff, which depends on ignore, which depends on walkdir. I actually managed to get it working though with these PRs and some other minor changes!

@BurntSushi
Copy link
Owner

@Timmmm That first link talks about it: https://blog.rust-lang.org/2024/11/26/wasip2-tier-2.html#standard-library-support

The WASI 0.2 Rust target reaching tier 2 platform support is in a way just the beginning. means it's supported and stable. While the platform itself is now stable, support in the stdlib for WASI 0.2 APIs is still limited. While the WASI 0.2 specification specifies APIs for example for timers, files, and sockets - if you try and use the stdlib APIs for these today, you'll find they don't yet work.

We expect to gradually extend the Rust stdlib with support for WASI 0.2 APIs throughout the remainder of this year into the next. That work has already started, with rust-lang/rust#129638 adding native support for std::net in Rust 1.83. We expect more of these PRs to land through the remainder of the year.

It will take time for these things to stabilize.

@Timmmm
Copy link
Author

Timmmm commented Feb 20, 2025

It doesn't say that nightly is required for wasip2 though... But yeah, anyway feel free to close this if you want. Using a fork is not too bad for my purposes. Ditto the ignore PR.

@BurntSushi
Copy link
Owner

That's how APIs get added to std. They land as unstable first. Then we stabilize them at some point in the future. (Stabilization is effectively the process of saying, "we promise to support this API ~forever.")

@BurntSushi
Copy link
Owner

But yeah I'll close this out for now. Happy to have this re-submitted once the APIs stabilize!

@BurntSushi BurntSushi closed this Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants