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
[BUG]: Some Rust crates haven't built for the newer Rust versions #4404
Comments
Encountering this as well: https://godbolt.org/z/3WMn4xKKo |
Hi! It appears that serde has an It is probably not a good idea to do an all-features build of serde as a result of this. You may hit this with other crates. Out of curiosity, why are you doing an all-features build in the first place? I've never seen this done for anything but docs generation (but I assume you have your reasons). Edited to add: your summary here is on to something:
The other thing you'd need to do is use a nightly build of the compiler -- the error message mentions that it's "stable release channel," which means the unstable features are unavailable. This means you can't use Rust 1.62 or 1.63 because those are stable releases. You could get this feature to build by using a nightly build from somewhere in the 1.63 range if this is something you need. |
Thanks for your message, totally understand about unstable. But we had to introduce it because of other features that don't fall under stable/unstable but are related to things that the user might want to be using. Here we compile first with --all-features and if that fails, with none We have a caching mechanism that might be preventing us to rebuild without --all-features, so that's one bug we'll need to fix. But there might also be something like 'we want to build with all the features except "unstable" ..' - would there be something like that? |
Perhaps also applicable; if we can supply RUSTC_BOOTSTRAP=1 as environment variable (is that possible with cargo?), would that ruin later linking to the library if the user compilation did not supply that envvar... Or could it still compile/link then.. |
Context relating to features: from what I've read https://serde.rs/feature-flags.html#derive "derive" is used often. That's why we went for --all-features.. But we might have to consider listing desired features per crate in our configuration (although that's going to be a pain) just to avoid it also trying to build "unstable" features... |
Crates aren't under any obligation to make sure every feature even builds at all, much less on every operating system. You could try to heuristically detect features that won't work in your environment, e.g. by looking for particular English names, but it won't work in the general case. Normally in Rust we let the user specify the feature set. Is that an option here, instead of choosing for everyone? |
... considering your approach more, I'm curious how you're doing feature unification if you're choosing features for each crate individually. |
We pre-build the libraries. Having user choose their own set and build the libraries with the user provided features will simply take too long both user-time and cpu-time. We're still a website after all... |
Fair! Compiling with default features might be a good compromise. It sounds like you're trying to force everything on, and if that fails, turning on none (which takes out serde derive among others). Rust crates have a notion of a default feature set, which appears to be what the rust playground uses to build libraries (their use case is the most similar to yours I can think of). |
Ah yes, this list https://github.com/rust-lang/rust-playground/blob/main/compiler/base/Cargo.toml It's likely the way to go.. it's going to hurt maintaining that list.. but maybe it's the only way |
Well, you don't need that list to do default features. You could try just not passing --no-default-features in your current build. That said, they generate that list with a tool that's in that same repo (top-crates) -- I bet you could run the tool if you wanted a nice list. |
We don't actually pass |
Ah, my mistake, I had expected that I would say, then, consider lifting the crate list generation tool / canned feature set from the Rust Playground, so that you don't have to maintain your own. While their set of crates is somewhat conservative, it's enough for a lot of purposes. |
Now that I'm at an actual keyboard - if you wanted to mirror the Playground behavior, you could use this: https://github.com/rust-lang/rust-playground/blob/main/top-crates/src/main.rs This uses stats from the package manager to do a "popularity contest" of crates. It's playground-specific, but only in that it generates a build file for a package named "playground." It looks like the output path can be overridden. So I bet this would work out of the box. One of the features it supports is a custom package metadata key, So, if you were to either use the tool or just consume the |
Describe the bug
For example serde 1.0.137 is giving this error on build:
I wonder if it's something that we're doing wrong during build, or that we simply have to use a newer version because this feature just changed between Rust 1.62 and 1.63.
Although it has not changed in the subsequent versions of Serde, the code here is still the same https://github.com/serde-rs/serde/blob/master/serde/src/lib.rs#L87
So maybe this is where we're hitting the "all features" on issue. (we first build with all features, if that fails, we're supposed to build without features)
So maybe that's somehow blocked now due to the build having been registered as failed and it doesn't try to build again...
Will need to do some testing.
Some other time
Steps to reproduce
Expected behavior
rand_core has built without problems
Reproduction link
Not applicable
Screenshots
Not applicable
Operating System
No response
Browser version
No response
The text was updated successfully, but these errors were encountered: