Skip to content

std: Add initial support for the wasm32-webp2 target - #165932

Open
alexcrichton wants to merge 1 commit into
rust-lang:mainfrom
alexcrichton:wasm32-webp2-target
Open

alexcrichton wants to merge 1 commit into
rust-lang:mainfrom
alexcrichton:wasm32-webp2-target

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit is intended to be the initial work in adding a wasm32-webp2 target to the Rust compiler. This has been previously approved in an MCP/1037 and discussed on Zulip as well. This is a tier 3 target meaning that there will be no precompiled artifacts nor any testing in CI. I've locally verified that the target builds without warnings and produces components of the expected shape.

In general this target is intended to be pretty similar to target_os = "wasi" targets. Most of the adjustments in the standard library area accounting for target_os = "web" next to target_os = "wasi". Some minor locations differ such as randomness. Otherwise this means that the web target inherits the same general strategy of the WASI targets, which is to use unix.rs-style implementations in most places. This places much of the portability burden on wasi-libc which internally has #defines and such to use the appropriate implementation. An example of this is clock_gettime is used on Web and WASI targets to implement SystemTime and Instant, and internally wasi-libc implements this with either Web or WASI interfaces depending on the target.

This support all requires a minor change in the libc crate to support the "web" target a well, effectively turning on definitions for all wasi-libc based targets. Locally this was tested with [patch], but this PR does not include that so the wasm32-webp2 target will not be buildable as-is in-tree until the libc crate has a published release and rust-lang/rust updates.

@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added A-allocators Area: Custom and system allocators A-env Area: `std::env` (note: `std::process` is A-process) A-filesystem Area: `std::fs` labels Nov 13, 2026
@rustbot

rustbot commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

r? @joboet

rustbot has assigned @joboet.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 38 candidates
  • Random selection from 6 candidates

@rustbot rustbot added A-io Area: `std::io` (note: `std::fs`, `std::net`, `std::path` are A-filesystem, A-net, A-path) A-networking Area: `std::net` A-path Area: `std::path` (note: `std::fs` is A-filesystem) A-random Area: random data generation support A-time Area: `std::time` O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 13, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

This commit is intended to be the initial work in adding a
`wasm32-webp2` target to the Rust compiler. This has been previously
approved in an [MCP/1037][mcp] and discussed on Zulip as well. This is a
tier 3 target meaning that there will be no precompiled artifacts nor
any testing in CI. I've locally verified that the target builds without
warnings and produces components of the expected shape.

In general this target is intended to be pretty similar to `target_os =
"wasi"` targets. Most of the adjustments in the standard library area
accounting for `target_os = "web"` next to `target_os = "wasi"`. Some
minor locations differ such as randomness. Otherwise this means that the
web target inherits the same general strategy of the WASI targets, which
is to use `unix.rs`-style implementations in most places. This places
much of the portability burden on wasi-libc which internally has
`#define`s and such to use the appropriate implementation. An example of
this is `clock_gettime` is used on Web and WASI targets to implement
`SystemTime` and `Instant`, and internally wasi-libc implements this
with either Web or WASI interfaces depending on the target.

This support all requires [a minor change in the `libc` crate][libc] to support
the "web" target a well, effectively turning on definitions for all wasi-libc
based targets. Locally this was tested with `[patch]`, but this PR does
not include that so the `wasm32-webp2` target will not be buildable
as-is in-tree until the `libc` crate has a published release and
rust-lang/rust updates.

[mcp]: rust-lang/compiler-team#1037
[libc]: rust-lang/libc#5733
@rustbot

rustbot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocators Area: Custom and system allocators A-env Area: `std::env` (note: `std::process` is A-process) A-filesystem Area: `std::fs` A-io Area: `std::io` (note: `std::fs`, `std::net`, `std::path` are A-filesystem, A-net, A-path) A-networking Area: `std::net` A-path Area: `std::path` (note: `std::fs` is A-filesystem) A-random Area: random data generation support A-time Area: `std::time` O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants