Stream: rust-toolchain

Topic: [post] Changes to Rust's WASI targets


view this post on Zulip Yoshua Wuyts (Apr 09 2024 at 22:12):

Published this today on the Rust blog: https://blog.rust-lang.org/2024/04/09/updates-to-rusts-wasi-targets.html - FYI for people here tracking Rust toolchain work

Empowering everyone to build reliable and efficient software.

view this post on Zulip Jeff Parsons (Apr 10 2024 at 02:00):

Purely out of curiosity, do you know if anybody is blogging/Tweeting/Tooting about the implementation details of Rust toolchain work as they go? I'm particularly interested in how much y'all expect to build upon wasi-libc vs. implement directly against the WASI ABI, and how the nascent async work is likely to interact with this — e.g. everything stays on forks for now, a separate wasm32-wasip3 target ASAP, or somehow allowing tinkering with async on the wasip2 target?

view this post on Zulip Jeff Parsons (Apr 10 2024 at 02:00):

:pray::man_bowing:

view this post on Zulip Joel Dice (Apr 10 2024 at 14:20):

FWIW, I very much expect Rust's std will continue to build upon wasi-libc. It can't use the WASI ABI directly without sacrificing interoperability with C code, since wasi-libc is the one responsible for mapping POSIX-style file descriptors to WASI resource handles. If Rust's std tried to do that itself, it would end up with a mapping that's incompatible with wasi-libc's , preventing Rust and C code from passing descriptors back and forth.

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:43):

Oh, someone on Reddit asked a really good question about how to migrate existing cfg's targeting target_os = "wasi" to continue working on the new target: https://www.reddit.com/r/rust/comments/1f9qbpv/comment/llqyh9i/

I responded, but I'm wondering if perhaps we should file a PR to the announcement post to include this info?

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:44):

This seems something other folks will start running into as well

view this post on Zulip Alex Crichton (Sep 06 2024 at 17:48):

if backwards compat is needed then target_os = "wasi", not(target_env = "p2") will suffice

view this post on Zulip Alex Crichton (Sep 06 2024 at 17:48):

that's, however, not necessarily future-compatible with a p3, so there's a tradeoff

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:49):

Alex Crichton said:

if backwards compat is needed then target_os = "wasi", not(target_env = "p2") will suffice

wait, can you explain why that's better than passing target_env = "p1" ?

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:49):

I assume there's a reason, but not sure I get it?

view this post on Zulip Alex Crichton (Sep 06 2024 at 17:50):

oh the difference is that target_env = "p1" was added recently, something like 1.80.0 IIRC

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:50):

oh like that!

view this post on Zulip Alex Crichton (Sep 06 2024 at 17:50):

so if a crate wants to support rustc 1.79.0 and prior with p1 you can't rely on target_env = "p1"

view this post on Zulip Alex Crichton (Sep 06 2024 at 17:50):

the "official" way to select p1, however, is target_env = "p1" for sure

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:53):

wait, can't we just tell people to do

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:53):

target_os = "wasi", not(target_env = "p2"), not(target_env = "p3")

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:53):

for like, Ultimate Backwards Compat

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:54):

(at the cost of readability I guess)

view this post on Zulip Yoshua Wuyts (Sep 06 2024 at 17:56):

(updated the comment to include the line about backwards-compat)

view this post on Zulip Alex Crichton (Sep 06 2024 at 18:29):

oh I wouldn't recommend that

view this post on Zulip Alex Crichton (Sep 06 2024 at 18:30):

mostly b/c target_env = "p3" doesn't actually exist yet

view this post on Zulip Alex Crichton (Sep 06 2024 at 18:30):

and it also doesn't include a theoretical target_env = "p4"


Last updated: Dec 23 2024 at 13:07 UTC