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

Unfixable breakage on wasm32? #802

Closed
jvdwrf opened this issue Feb 12, 2025 · 5 comments
Closed

Unfixable breakage on wasm32? #802

jvdwrf opened this issue Feb 12, 2025 · 5 comments

Comments

@jvdwrf
Copy link

jvdwrf commented Feb 12, 2025

Hi, after updating to 1.13, my build for wasm32-unknown-unknown with js broke.

I already had the js feature enabled, however still I got the error that getrandom should have the wasm_js feature enabled.

I already have rustflags for wasm set to rustflags = ['--cfg', 'getrandom_backend="wasm_js"', '-Awarnings']. This is working fine for rand 0.9 which I am using myself. It is only uuid that causes the compilation error for getrandom 0.3.

I have tried a combination of using the uuid/js, uuid/getrandom and uuid/rand features, but the breakage stays. Downgrading to 1.12 fixes the issue for me. I am using uuid with features v4 and serde.

Any help would be much appreciated.

@hrzlgnm
Copy link

hrzlgnm commented Feb 12, 2025

I'm also facing the issue that the newer version 1.13.1 fails to build, when renovate tries to update the lockfile

@KodrAus
Copy link
Member

KodrAus commented Feb 12, 2025

@jvdwrf What's the build error you're seeing?

@digimatic
Copy link

digimatic commented Feb 12, 2025

I started to get build errors with wasm32 after upgrading to latest toolchain 1.84.
Errors i get:

error[E0433]: failed to resolve: could not find `RngImp` in `imp`
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:10:10
    |
10  |     imp::RngImp::u128()
    |          ^^^^^^ could not find `RngImp` in `imp`
    |
note: found an item that was configured out
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:107:23
    |
107 |     pub(super) struct RngImp;
    |                       ^^^^^^
note: the item is gated behind the `rng-rand` feature
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:106:11
    |
106 |     #[cfg(feature = "rng-rand")]
    |           ^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:126:23
    |
126 |     pub(super) struct RngImp;
    |                       ^^^^^^
note: the item is gated here
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:125:5
    |
125 |     #[cfg(all(feature = "rng-getrandom", not(feature = "rng-rand")))]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: found an item that was configured out
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:170:23
    |
170 |     pub(super) struct RngImp;
    |                       ^^^^^^
note: the item is gated here
   --> /Users/peterw/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uuid-1.13.1/src/rng.rs:165:5
    |
165 | /     #[cfg(all(
166 | |         feature = "js",
167 | |         not(feature = "rng-rand"),
168 | |         not(feature = "rng-getrandom")
169 | |     ))]
    | |_______^

@KodrAus
Copy link
Member

KodrAus commented Feb 12, 2025

Ah, I think we should improve the error message you get there by adding a compile_error! block. The issue there looks like you're using uuid on wasm32-unknown-unknown without the js feature, relying on getrandom to provide a backend. You can either:

  1. Add the js feature to uuid.
  2. Add the rng-getrandom feature to uuid and use getrandom 0.3 to configure your backend.

@KodrAus
Copy link
Member

KodrAus commented Feb 20, 2025

I've added a more useful compile_error! message here when neither the js or rng-getrandom/rng-rand features are enabled and the target is wasm32-unknown-unknown. I'll go ahead and close this one now, but if there's any more detail to add please feel free to re-open or create new issues.

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

No branches or pull requests

4 participants