Skip to content

Conversation

@alexcrichton
Copy link
Member

@alexcrichton alexcrichton commented Aug 1, 2024

This commit is a result of the discussion on #128475 and incorporates parts of #109807 as well. This is all done as a new page of documentation for the wasm32-unknown-unknown target which previously did not exist. This new page goes into details about the preexisting target and additionally documents the expectations for WebAssembly features and code generation.

The tl;dr is that LLVM will enable features over time after most engines have had support for awhile. Compiling without features requires -Ctarget-cpu=mvp to rustc plus -Zbuild-std to Cargo.

Closes #109807
Closes #119811
Closes #128475

EDIT: for the relnotes label please see this comment for recommended release notes.

This commit is a result of the discussion on rust-lang#128475 and incorporates
parts of rust-lang#109807 as well. This is all done as a new page of
documentation for the `wasm32-unknown-unknown` target which previously
did not exist. This new page goes into details about the preexisting
target and additionally documents the expectations for WebAssembly
features and code generation.

The tl;dr is that LLVM will enable features over time after most engines
have had support for awhile. Compiling without features requires
`-Ctarget-cpu=mvp` to rustc plus `-Zbuild-std` to Cargo.

Closes rust-lang#109807
Closes rust-lang#128475
@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2024

r? @GuillaumeGomez

rustbot has assigned @GuillaumeGomez.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 1, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2024

Some changes occurred in src/doc/rustc/src/platform-support

cc @Noratrieb

@alexcrichton
Copy link
Member Author

If this is accepted then I will additionally comment on #127513 with a recommended rewording of the release notes to indicate that this does affect WebAssembly binaries.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link

@bb010g bb010g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A wording nit & spelling nits.

@workingjubilee
Copy link
Member

@alexcrichton Is it possible to get an rmake test for the workarounds here, or landing a test in rust-lang/cargo?

@alexcrichton
Copy link
Member Author

I was looking into that yeah and was hoping I could combine -Clto somehow to get a test in-tree, but the conclusion ended up being that it didn't have the right behavior of rewriting target features per function that I thought was happening. That means that such a test requires -Zbuild-std which while there is one test in tree that does this that test looks relatively complicated and specialized so I was wary to try to copy it.

I can look into adding a test in Cargo, yeah, but it feels like an odd location for such a test given that the regressions, if any, would likely come from this repo instead of Cargo. One option would be to refactor the existing Zbuild-std test in this repo, but I'm also not sure if folks are keen on expanding that due to the amount of time such a test would take compiling the standard library.

@jieyouxu
Copy link
Member

jieyouxu commented Aug 9, 2024

I was looking into that yeah and was hoping I could combine -Clto somehow to get a test in-tree, but the conclusion ended up being that it didn't have the right behavior of rewriting target features per function that I thought was happening. That means that such a test requires -Zbuild-std which while there is one test in tree that does this that test looks relatively complicated and specialized so I was wary to try to copy it.

Yeah, unfortunately the compiler-builtins test takes a really long time to build the stdlib again, since it relies on very specific configurations. I don't have a good solution for this either, if it requires building yet another customized version of std.

@alexcrichton
Copy link
Member Author

ping @GuillaumeGomez would you be able to review this? Or should I try to get a different sign-off?

@GuillaumeGomez
Copy link
Member

I'm often assigned for such PRs but I have nothing to do with this part. Please pick someone else. ^^'

@danielhjacobs
Copy link

danielhjacobs commented Oct 27, 2024

Is the minimum supported Safari version for this target version 15: https://caniuse.com/wasm-reference-types?

Plus minimum supported Chrome/Edge version 96,

@danielhjacobs
Copy link

I really just wish Rust hadn't enabled extra target features by default when it's so easy to enable extra target features and so hard to disable them. Why can't that be down to the crates to enable?

@daxpedda
Copy link
Contributor

daxpedda commented Nov 7, 2024

Just for clarification: Rust didn't enable those features by default, LLVM did.
But please see this blog post for full context.

@workingjubilee
Copy link
Member

workingjubilee commented Nov 7, 2024

Please open a new issue or a discussion on Zulip if you wish to continue this.

@rust-lang rust-lang locked as resolved and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

O-wasm Target: WASM (WebAssembly), http://webassembly.org/ relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-release Relevant to the release subteam, which will review and decide on the PR/issue.

Projects

None yet