-
Notifications
You must be signed in to change notification settings - Fork 10
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
Pinning dependency versions prevents downstream users from depending on newer compatible releases #42
Comments
It's also worth mentioning that the pinning didn't actually provide any MSRV guarantees anyway, since you still have unpinned transitive dependencies. |
Thanks for this bug report. Until a solution is found and released, a workaround for this issue would be to turn off the |
It seems this is an artifact of cargo's implementation and could be solved by cargo itself in the future. I therefore don't see this as an issue with @teozkr, I suggest you use the workaround I mentioned in my previous comment if this issue is blocking you. I'm planning on updating |
It might not affect this case in particular, but there's a whole other can of worms you're opening as soon as you start allowing mixing crate versions (in particular, around trait resolution). I doubt it will be supported any time soon. And as the comment you linked to ends with:
There does seem to be some movement towards using the MSRV field from Cargo.toml for generating compatible resolutions (https://rust-lang.github.io/rfcs/2495-min-rust-version.html#influencing-version-resolution), but I'm not sure about the current state of that.
With all due respect to you and this project, it's not really sustainable for the whole ecosystem to have to do these upgrades in precise lockstep, which is the inevitable outcome if this practice becomes standard across the board. While I appreciate your offer to do an emergency release, we can't in good conscience depend on that happening every time this issue rears its head. The description of #43 also makes it seem like it is headed in the direction of further breakage, so it looks like our only long-term option is to eliminate our dependencies on duplicate. |
How so? Cargo already allows mixing two different major versions of the same crate even if they have the same traits. Wouldn't this already be a problem then? From my reading of the linked issue and @alexcrichton's comment, I didn't see any specific issue that would block this implementation except for manpower.
Which practice are you referring to? pinning versions in general,
Switching to
If you disable all |
Currently, This isn't even guaranteed to fail at compile time. For example, it also affects downcasting values at runtime from
Version pinning.
Until
As I discovered after posting this issue, it turns out that all of our uses (but not the dependency declarations) of |
How can anyone rely on this (technically)? At any one time, each crates is only compiled with and interfaces with 1 version of a dependency. Why does it matter what version other crates are using?
While I understand the problem and agree that it is problematic, I don't see how to avoid this when trying to uphold an MSRV (even the ones more lenient than
Let's hope |
Crate A depends a trait For this simple case you could solve this by reexporting A from B (
That's the most common case, but it isn't strictly true. You can use renamed crate references to depend on multiple (incompatible) versions of the same crate. This is sometimes used for compatibility layers (like
If libraries use wide viable version bounds then downstream application crates that do depend on some MSRV can add direct dependencies on the same upstream library with additional constraints. It also won't break existing dependencies unless they manually run The downside is a somewhat more confusing experience for users that add the library as a new dependency but need to content with a restrictive existing MSRV. Hopefully the
:P |
@teozkr thanks for the explanations, I appreciate you putting the time in to explain. I think I understand it, but it feels like quantum mechanics (if you think you understand it, then you don't). I will think about this for a bit and try to find some sort of solution that would allow not pinning dependencies with more lenient MSRV's. |
Situation:
Combine
duplicate
with another dependency that depends on heck^0.3.3
.Reproduction:
Expected Behavior:
duplicate is built using the semver-compatible heck 0.3.3 instead.
Actual Behavior:
The build fails because Cargo refuses to make a build graph that combines both heck 0.3.2 and heck 0.3.3.
Affected Versions:
0.3.0
Local Environment:
cargo 1.56.0 (4ed5d137b 2021-10-04)
rustc 1.56.1 (59eed8a2a 2021-11-01)
Miscellaneous:
Submitted a PR as #41.
The text was updated successfully, but these errors were encountered: