-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo claims to ignore binary dependencies, but does unify features anyway #14406
Comments
When it says the dependency is ignored, I believe it is referring to build impact. We resolve features before we know whether a package has a Could you help me understand the impact of this? If its "invalid" to have that dependency in the first place, wouldn't the correction be to remove it? At that point, feature unification wouldn't matter. |
If that's the case, then I find the message emitted highly misleading. It shouldn't state that this crate is ignored, but instead something like "skipping to build crate
Ok let me try that. As you observed and as mentioned by cargo it's not meaningful to have a Now there is a deeper underlying issue in how the feature unification works here. The examples uses a (Also I disagree with adding the |
At this time, I can't enumerate all of the ways it is ignored and the distinction of how much its ignored doesn't seem relevant to the actual problem you are concerned about.
So the root problem is that end-users are trying to transfer knowledge from other ecosystems which is breaking with diesel due to how features are being resolved. Is that right? Seems like our conversation then should focus on that and we should close this issue. For the knowledge-transfer part, if we had #2267, then your docs could reference it and that would bypass the problem
As this is off topic for this issue, I've not dug into this. Might be good to have a dedicated space to talk about it. Real quick though, you don't need to tell people to use an old edition but you can tell them to set
I added the |
Problem
Given the following
Cargo.toml
file:Cargo emits the following output:
Relevant default features at the time of writing:
Diesel: no backends enabled
Diesel-CLI:
postgres sqlite mysql
Steps
Cargo.toml
content from abovecargo check
Possible Solution(s)
Cargo should ignore features coming from invalid dependencies or it shouldn't claim that it ignored these dependencies.
Notes
As additional note: There is also some problematic behavior how features are unified here. The proc macro crate
diesel-derives
is build once for both the backend dependency and the build-dependency. Given that this must be a separate crate and we must generate feature dependent code there and cargo chooses to compile the crate once for both sets of features there is no way for us as diesel authors to generate the correct set of code. As far as I remember that is expected behavior but it is incredibility frustrating to not being able to fix that correctly on our side. It's also something our users sometimes running into and getting confusing error messages. Funnily it's something that worked with the old resolver. I remember that I raised this concern already back then while choosing to go with the v2 resolver by default for the 2021 edition but that concern was dismissed back then.Version
The text was updated successfully, but these errors were encountered: