Add a new wasm32-wasip2 target#119616
Conversation
|
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
|
These commits modify compiler targets. These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
0642b4a to
44696a8
Compare
This comment has been minimized.
This comment has been minimized.
44696a8 to
dcf7c7b
Compare
This comment has been minimized.
This comment has been minimized.
Nothing in that MCP mentions that the |
|
Leaving target_os as wasi for all wasi related targets is probably an oversight of the MCP. The wasi preview 1 and preview 2 logical OSes have very significant differences that go beyond just the ABI level. I don't believe we would want to rely on Preview 2 and preview 1 differ from each other in the following ways:
Does I tried looking at how Windows versions are handled and surprisingly it seems that cc @alexcrichton. |
|
Part of the motivation for adding an entirely new target is that existing I bring this up in that this is motivation for not only a new target but additionally a new
This PR is sort of where that TBD is being resolved. Given the motivation for adding a brand new target to rustc this is what additionally motivates the addition of a new I would ideally like to rename the |
|
I do think that using In the case of |
|
I think the breakage and what to do can go both ways, so at least in my mind there's not a clear-cut answer of what the best route here is. As you've pointed out a con of changing To me one way to go about solving this is to ignore historical precedent (e.g. the preexisting Given all that I at least personally think it makes sense to have different If you'll continue to walk this hypothetical with me, the next question is that if this state of affairs is desirable does it make sense to retrofit onto the existing ecosystem. Personally I think so. The new component-based target is "new enough" that I'm not sure it's worth it to keep everything working seamlessly as much as possible. This is a good opportunity to rethink what WASI support means and how best to support it. For example That's at least my thinking, although I don't know how best to resolve this still myself. I personally think it's best to go with |
|
I don't have strong feelings on how to differentiate between preview1 and preview2, but I do have strong opinions that there needs to be some way of doing it. I agree with @alexcrichton that preview2 is different enough from preview1 that it can argued that preview2 is an entirely different OS, but it can also be argued that preview2 is just a newer version of the same logical operating system (albeit with very deep and significant changes!). Looking at how the question of new versions of operating systems are already handled in rustc, there's unfortunately not good, clear precedent for what to do. Windows based targets that want to target older versions that what What all of this seems to indicate is that there is likely no obviously correct answer, and so we should pick something that:
Talking with a few others, it does seem like perhaps |
|
One more thing worth noting is that Not breaking this use case is very important so target_env is the best way to go |
|
I was talking with Ryan a bit off-thread as well and I agree now too that |
This comment was marked as resolved.
This comment was marked as resolved.
|
👍 for r? compiler |
|
The |
25d3cd2 to
8209450
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
1a17268 to
dee295f
Compare
This comment has been minimized.
This comment has been minimized.
dee295f to
5144e61
Compare
Signed-off-by: Ryan Levick <me@ryanlevick.com>
5144e61 to
5e9bed7
Compare
|
For historical reference and if anyone's interested, here's the notes for the last meeting where the naming of "p2" vs "preview2" was discussed. The salient points in the notes, to copy/paste here, are:
This was discussed a bit more in-depth in that meeting that the notes don't capture super well, but the consensus was that the "p2" naming is the best going forward as it means "preview 2" in the standards context, "point two" to folks who just want to know what it is, it aligns with what others are already leaning towards (Go), and it's easier to type. |
Okay, now it looks like it's ready for Bors. 😊 |
|
@bors r=petrochenkov,m-ou-se |
|
☀️ Test successful - checks-actions |
This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * rust-lang/compiler-team#607 * rust-lang/compiler-team#695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](rust-lang#119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
|
Finished benchmarking commit (ef32456): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 651.173s -> 651.239s (0.01%) |
…ame, r=wesleywiser Add a new `wasm32-wasip1` target to rustc This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * rust-lang/compiler-team#607 * rust-lang/compiler-team#695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](rust-lang#119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
…ame, r=wesleywiser Add a new `wasm32-wasip1` target to rustc This commit adds a new target called `wasm32-wasip1` to rustc. This new target is explained in these two MCPs: * rust-lang/compiler-team#607 * rust-lang/compiler-team#695 In short, the previous `wasm32-wasi` target is going to be renamed to `wasm32-wasip1` to better live alongside the [new `wasm32-wasip2` target](rust-lang#119616). This new target is added alongside the `wasm32-wasi` target and has the exact same definition as the previous target. This PR is effectively a rename of `wasm32-wasi` to `wasm32-wasip1`. Note, however, that as explained in rust-lang/compiler-team#695 the previous `wasm32-wasi` target is not being removed at this time. This change will reach stable Rust before even a warning about the rename will be printed. At this time this change is just the start where a new target is introduced and users can start migrating if they support only Nightly for example.
|
Would be nice to see the PR name and description updated to match what actually landed (in particular regarding the target name). This just confused be quite a bit.^^ |
This is the initial implementation of the MCP rust-lang/compiler-team#694 creating a new tier 3 target
wasm32-wasip2. That MCP has been seconded and will most likely be approved in a little over a week from now. For more information on the need for this target, please read the MCP.There is one aspect of this PR that will become insta-stable once these changes reach a stable compiler:
target_familynamedwasiis introduced. This target family incorporates all wasi targets includingwasm32-wasiand its derivativewasm32-wasi-preview1-threads. The difference betweentarget_family = wasiandtarget_os = wasiwill become much clearer whenwasm32-wasiis renamed towasm32-wasi-preview1and thetarget_osbecomeswasm32-wasi-preview1. You can read about this target rename in this MCP which has also been seconded and will hopefully be officially approved soon.Additional technical details include:
std::sys::wasi_preview2andstd::os::wasi_preview2have been created and mostly use#[path]annotations on their submodules to reach into the existingwasi(soon to bewasi_preview1) modules. Over time the differences betweenwasi_preview1andwasi_preview2will grow and most like all#[path]based module aliases will fall away.wasi-preview2relies on awasi-sdkin the same way thatwasi-preview1does (one must include awasi-rootpath in theConfig.tomlpointing to sysroot included in the wasi-sdk). The target should build against wasi-sdk v21 without modifications. However, the wasi-sdk itself is growing preview2 support so this might shift rapidly. We will be following along quickly to make sure that building the target remains possible as the wasi-sdk changes.