-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Update to rand 0.9.0 #136395
base: master
Are you sure you want to change the base?
Update to rand 0.9.0 #136395
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
Oh getrandom updated the wasi dependency and that now includes a dependency on |
The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging. |
☔ The latest upstream changes (presumably #136454) made this pull request unmergeable. Please resolve the merge conflicts. |
Hm, so I don't have any hard objections to wit-bindgen-rt, but it's a pretty weird crate... it has no README on crates.io, and looking at the raw artifacts there seems to be C and some non-source files (wit-bindgen-rt-0.39.0/src/cabi_realloc.o, wit-bindgen-rt-0.39.0/src/libwit_bindgen_cabi_realloc.a) in it? That seems to get linked in on wasm32 targets, which feels somewhat surprising to me -- I wouldn't have expected binary artifacts in crates.io. @alexcrichton could we perhaps add a README to the crate explaining why it has compiled artifacts? I suspect that's just going to reference the comment in https://github.com/bytecodealliance/wit-bindgen/blob/main/ci/rebuild-libcabi-realloc.sh, but since that file isn't shipped with the crate I had to do some hunting to find it :) It's my understanding that at least some upstream consumers of Rust don't want compiled artifacts in the "source" which this would be semi-introducing (it looks like miri already depends on this crate), I'm not sure how much of a problem that is in practice given what this is doing but it feels at least somewhat iffy. @wesleywiser / @davidtwco as T-compiler leads probably worth taking a look. Should we have some policy around this sort of thing? Maybe there's some other way we can help achieve the goal of ~weak symbols this crate wants on stable?
|
As one option I wonder if the pre-compiled sources could be replaced with a dependency on (for example) wasm-encoder and just producing them from the build script? That's likely to be slower to build but it would make confirming that the file is what it says it is to some extent easier. |
Oh dear apologies if this is causing issues! As an internal implementation detail of wit-bindgen we didn't pay too much attention to public-facing documentation but I'm happy to add a README and/or crate docs pointing to the build script at the bare minimum.
If it helps at all we have documented/automated build instructions for this artifact in CI and it's always ensured that the checked-in copy is always up-to-date. This is intended to show that it's at least reproducible and matches the sources in tree. I realize though that such a setup may still not be sufficient for some consumers.
I can confirm that the feature we're lacking in Rust to avoid this artifact is indeed weak symbols. Specifically we want the ability to have a symbol,
This is indeed possible! That's more-or-less what this build script does for an unrelated part of wasm. We manually assemble a |
Yeah, I agree that manually writing out the bytes is only sort of an improvement. It does feel plausible that in e.g. a reproducible builds or company import policy it would matter. One thought I did have is that you could plausibly produce the object "just in time" with a RUSTC_BOOTSTRAP rustc toolchain, but that doesn't seem like a great idea. Or maybe having some tool (a-la patchelf or a linker script or something) that edits the symbol a stable Rust compiler can produce. I don't personally have a strong objection given the specific context here (and the lack of meaningful code in the blob) but it does seem like somewhat of a slippery slope. In this particular context I suspect this dependency is never(?) actually used since rustc or miri probably never get built for wasm (at least not by us). So maybe we just say that makes this mostly a non-issue. I'll nominate this for T-compiler to make a final call, and whatever we end up deciding we should probably make a policy note somewhere. |
I do think a README would be good to add. I'll also note the published artifact doesn't have a LICENSE file (again, not sure it matters, and is probably not uncommon, but perhaps not strictly ideal). |
I've added a README at bytecodealliance/wit-bindgen#1162 and for LICENSE stuff we generally rely on the |
☔ The latest upstream changes (presumably #136845) made this pull request unmergeable. Please resolve the merge conflicts. |
e31d797
to
c8755f0
Compare
Would it be possible to have a feature or even a global config so that the compiler can opt-in to using the nightly feature for weak symbols instead of the precompiled artefacts? Generally the compiler is fine with using nightly features that have no stability guarantees but I can understand not wanting to expose your users to that. e.g. for the |
I'd be happy to do that yeah, but would want to confirm that would help here? That wouldn't actually remove the binary artifacts, it'd only configure things to not actually use them at compile-time. Is that sufficient for users who would push back against the inclusion of binary artifacts? (it's sort of just a pinky-promise to not use them as opposed to a guarantee) |
☔ The latest upstream changes (presumably #137164) made this pull request unmergeable. Please resolve the merge conflicts. |
c8755f0
to
5b7fdb8
Compare
I'll wait for @wesleywiser to comment on that. I can only say that what |
Sorry for the late feedback, we discussed this PR last week in the triage meeting (on Zulip). @alexcrichton we basically wanted to know more about (and how feasable) removing the binary blob completely (that you mentioned here). Maybe Wesley can add more. Also mentioned that since we clearly know what this blob is (comment), maybe we can also evaluate a byte-per-byte tidy check? @rustbot label -I-compiler-nominated |
Completely removing this blob is unfortunately probably going to take a bit of time. I'm kind of short on time right now and don't have the cycles to invest in rewriting the construction process for this blob in a build script instead of having it checked in. It's certainly feasible to do, but it's quite nontrivial and requires shuffling things around (plus picking up nontrivial build-time dependencies which has further impacts, etc). To answer some questions/thoughts that came up in that discussion though:
Overall I feel like this is relatively side-tracked from the actual thrust of this PR, updating the I also realize that the preferred compiler solution is to remove the blob entirely, and I agree with that! I mostly want to clarify that doing so is going to take a nontrivial chunk of work of my time (or someone else's) and has consequences on the crate's usage in the ecosystem which aren't free. Also if desired I'm happy to chat on Zulip in a meeting about this or similar, or move this discussion to a separate issue or similar. |
The |
Here's a counter proposal -- I think arguably simpler -- we just pin the version of this crate in Cargo.toml (= dependency) somewhere, ensuring that we only intentionally bump it. At that point this binary blob is not really any different to our "binary blob" dependency on providing a rustc, gcc, etc. -- it can be built from source but usually isn't. That also mitigates risk since if/when we do actually bump this dependency we can check that the new blob is still small, etc. I'd personally be happy to r+ this with that change (explicit pinning) made. |
This comment has been minimized.
This comment has been minimized.
I couldn't figure out how to do this robustly. Cargo is designed to support multiple versions of the same dependency. We can lock a direct dependency but if a dependency of a dependency bumps the major wit-bindgen-rt version then I don't think we can protect against that using My counter-counter proposal that I just pushed is to support |
☔ The latest upstream changes (presumably #137927) made this pull request unmergeable. Please resolve the merge conflicts. |
Changes include:
thread_rng
has been renamed torng
Standard
has been renamed toStandardUniform
gen
,gen_range
,gen_bool
have been renamed torandom
,random_range
andrandom_bool
respectively.