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

fix: enable wasip2 feature for wasm32-wasip2 target #960

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

brooksmtownsend
Copy link
Contributor

@brooksmtownsend brooksmtownsend commented Aug 15, 2024

Fixes #958

Hi! 👋🏻

wasm32-wasip2 is a tier 3 target for compilation in Rust, and has landed in Rust nightly.

I'm working on seanmonstar/reqwest#2290 and hoping to add wasm32-wasip2 support for a crate or two that depend on url, the compiler error currently when building shows:

➜ cargo +nightly build --target wasm32-wasip2
warning: /Users/brooks/github.com/servo/rust-url/url_debug_tests/Cargo.toml: no edition set: defaulting to the 2015 edition while the latest is 2021
   Compiling url v2.5.2 (/Users/brooks/github.com/servo/rust-url/url)
error[E0658]: use of unstable library feature 'wasip2'
    --> url/src/lib.rs:2836:9
     |
2836 |     use std::os::wasi::prelude::OsStrExt;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: add `#![feature(wasip2)]` to the crate attributes to enable
     = note: this compiler was built on 2024-08-06; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'wasip2'
    --> url/src/lib.rs:2939:9
     |
2939 |     use std::os::wasi::prelude::OsStrExt;
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: add `#![feature(wasip2)]` to the crate attributes to enable
     = note: this compiler was built on 2024-08-06; consider upgrading it if it is out of date

For more information about this error, try `rustc --explain E0658`.
error: could not compile `url` (lib) due to 2 previous errors

After this PR:

 ➜ cargo +nightly build --target wasm32-wasip2                                                                      
warning: /Users/brooks/github.com/servo/rust-url/url_debug_tests/Cargo.toml: no edition set: defaulting to the 2015 edition while the latest is 2021
   Compiling tinyvec_macros v0.1.1
   Compiling unicode-bidi v0.3.15
   Compiling percent-encoding v2.3.1 (/Users/brooks/github.com/servo/rust-url/percent_encoding)
   Compiling tinyvec v1.8.0
   Compiling form_urlencoded v1.2.1 (/Users/brooks/github.com/servo/rust-url/form_urlencoded)
   Compiling unicode-normalization v0.1.23
   Compiling idna v0.5.0 (/Users/brooks/github.com/servo/rust-url/idna)
   Compiling url v2.5.2 (/Users/brooks/github.com/servo/rust-url/url)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.51s

Because this feature is only enabled when the target OS is wasi and the target ENV is p2, this shouldn't affect any other functionality

@brooksmtownsend
Copy link
Contributor Author

Hey @valenting just pinging for awareness 🙂

Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@54346fa). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #960   +/-   ##
=======================================
  Coverage        ?   81.67%           
=======================================
  Files           ?       21           
  Lines           ?     3548           
  Branches        ?        0           
=======================================
  Hits            ?     2898           
  Misses          ?      650           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brooksmtownsend
Copy link
Contributor Author

As far as I can tell the CI lints come in on Rust nightly and they aren't related to this change, same with the windows-latest run, but happy to address the lint issues here if desired

HttpRafa added a commit to HttpRafa/atomic-cloud that referenced this pull request Aug 30, 2024
@brooksmtownsend
Copy link
Contributor Author

@hsivonen would it be possible to get a review here? I'm not sure who the maintainers are, just looking for a set of eyes 😄

Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

FWIW I think it is an extremely poor choice on rustc's side to make an API conditionally need a feature gate. But that appears to be deliberate choice on their behalf so there's not much I can do about this. I'm fine merging this, but not a fan.

I've filed an upstream bug: rust-lang/rust#130323

url/src/lib.rs Show resolved Hide resolved
@Manishearth Manishearth added this pull request to the merge queue Sep 13, 2024
Merged via the queue into servo:main with commit c04aca3 Sep 13, 2024
10 of 14 checks passed
@brooksmtownsend brooksmtownsend deleted the fix/support-wasm32-wasi branch September 16, 2024 14:32
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Nov 5, 2024
Bumps url from 2.5.2 to 2.5.3.

Release notes
Sourced from url's releases.

v2.5.3
What's Changed

fix: enable wasip2 feature for wasm32-wasip2 target by @​brooksmtownsend in servo/rust-url#960
Fix idna tests with no_std by @​cjwatson in servo/rust-url#963
Fix debugger_visualizer test failures. by @​valenting in servo/rust-url#967
Add AsciiSet::EMPTY and boolean operators by @​joshka in servo/rust-url#969
mention why we pin unicode-width by @​Manishearth in servo/rust-url#972
refactor and add tests for percent encoding by @​joshka in servo/rust-url#977
Add a test for and fix issue #974 by @​hansl in servo/rust-url#975
no_std support for the url crate by @​domenukk in servo/rust-url#831
Normalize URL paths: convert /.//p, /..//p, and //p to p by @​theskim in servo/rust-url#943
support Hermit by @​m-mueller678 in servo/rust-url#985
fix: support wasm32-wasip2 on the stable channel by @​brooksmtownsend in servo/rust-url#983
Improve serde error output by @​konstin in servo/rust-url#982
OSS-Fuzz: Add more fuzzer by @​arthurscchan in servo/rust-url#988
Merge idna-v1x to main by @​hsivonen in servo/rust-url#990

New Contributors

@​brooksmtownsend made their first contribution in servo/rust-url#960
@​cjwatson made their first contribution in servo/rust-url#963
@​joshka made their first contribution in servo/rust-url#969
@​hansl made their first contribution in servo/rust-url#975
@​theskim made their first contribution in servo/rust-url#943
@​m-mueller678 made their first contribution in servo/rust-url#985
@​konstin made their first contribution in servo/rust-url#982
@​arthurscchan made their first contribution in servo/rust-url#988

Full Changelog: servo/[email protected]



Commits

8a683ff Merge idna-v1x to main (#990)
08a3268 OSS-Fuzz: Add more fuzzers (#988)
5d363cc Improve serde error output (#982)
30e6258 fix: support wasm32-wasip2 on stable channel (#983)
bf089c4 support hermit (#985)
b08a655 Normalize URL paths: convert /.//p, /..//p, and //p to p (#943)
ebd5cfb no_stdsupport for the url crate (#831)
7eccac9 Add a test for and fix issue #974 (#975)
710e1e7 refactor and add tests for percent encoding (#977)
6050a6e mention why we pin unicode-width (#972)
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.

Support for wasm32-wasip2 target
2 participants