-
Notifications
You must be signed in to change notification settings - Fork 194
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
0.1.9 seems to have broken wasm32-unknown-unknown #87
Comments
This change was introduced in #71 and we decided not to treat it as a breaking one. If you want the old behavior, you can enable the Are you really using |
The use of getrandom is because it's a dev-dependency for benchmarks, but tests build all dev-dependency crates even if tests don't use that crate because cargo is just silly like that. I don't believe any actual tests use getrandom. If the dummy feature is on does that affect targets besides wasm32-unknown-unknown? I don't mind flipping it on if non wasm targets aren't affected. Also, you cannot conditional include a feature in cargo as far as I know, so this sort of thing really needs to be a breaking change when you do it. |
Argh... [dev-dependencies]
getrandom = { version = "0.1", features = ["dummy"] } But unfortunately dev features leak to non-dev builds, due to the long-standing rust-lang/cargo#1796... As a temporary solution you can run CI tests with |
Alright I'll change the CI for now. Side note: I don't use |
@newpavlov I think we can learn from what other system crates (like I think we should change the behavior of @Lokathor would this work for your use case? If you don't actually call the getrandom function on unsupported platforms, everything should be fine. EDIT: This would also allow us to get rid of certain hacks in our |
@josephlr |
@newpavlov this is a good point, and why I suggested the warning. This way:
I’ll do an experiment to see if I can improve the diagnostics while keeping the above properties |
AFAIK there is no dedicated way to emit a compile time warning right now. Plus don't forget that it was requested in the |
Oh that’s too bad about not having |
I thought about it, but again, I doubt it will help much, since usually |
So, is the problem that there's no actual randomness to be had on wasm32-unknown-unknown, and the crate just never worked in the first place on that platform? |
Yes, without enabled |
@newpavlov I've been experimenting, and I think I've figured out a way to get a warning with the text we want to display. Going back to your previous comment:
This will still happen, as we would attempt to use the |
@josephlr But if we will usually get a compilation error in both cases, then why bother with the warning? |
To be clear: the flag enables the use of a dummy implementation only where no other implementation is available; i.e. it's safe to use everywhere but turns compile-time-failure into run-time-failure (should for any reason no impl be available). @newpavlov's answer to this may have caused confusion. @josephlr no, I don't wish to go back to using fat
|
Unfortunately I don't think we should make such recommendation. Doing it in a library crate will enable the [dev-dependencies]
getrandom = { version = "0.1", features = ["dummy"] } Will not work properly either, due to the linked earlier feature leakage. I think the workaround with manual |
Sorry, I missed this. Can you clarify in #89 then? |
Just to clarify. Do we all think that the leakage from If that is the case, when does a library ever get compiled stand-alone, except for tests/examples/benchmarks, when dev-dependencies apply? |
This seems to be the answer: tokio-rs/tokio#1318 (comment) to the feature leaking question. |
Good find! I guess then projects can enable the |
Ran into this issue as well and was a bit surprised first, but managed to resolve it. Ideally don't want any of our dependencies to include So the second best thing for us is to just continue to get a panic if [target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.1.9", features = ["dummy"] } # https://github.com/rust-random/getrandom/issues/87 Hopefully we can make using rand in a lot of crates an optional feature that is not enabled by default, though I'm not too hopefully of that due to the additive nature of rand and how many crates that depend on it. Update: Was able to just use |
I'd like to add in my opinion that this was a breaking change and should be reverted, the default behavior for wasm32-unknown-unknown should follow the standard library by returning an error, not yielding a compile-time error. |
I don't see why we should make exception for |
0.1 needs to get reverted and stay with "it builds fine and panics at runtime", or whatever the runtime behavior was before. That's basically unarguable, that's just a semver thing. In 0.2 you can do the whole feature thing, but since the And the crate should always build, all the time. |
@Lokathor @newpavlov I've got a patch in progress to fix this. It seems fine to just use the dummy implementation for wasm32-unknown-unknown at the moment. Then we can just release 1.10 and yank 1.9 We would still keep the |
I just started to get CI breaks today with 0.1.9, saying that wasm32-unknown-unknown is an unsupported platform, but things were fine before today.
Does the new version need to be yanked and then published as 0.2.0?
The text was updated successfully, but these errors were encountered: