Update windows dependency to 0.62#52
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I think it is better to depend on it via >0.61, so that the unification may happen in case any other version is used too. Thank you for the help! |
64d88e3 to
192a65d
Compare
|
Pardon, just realised it should have been inclusive: >=0.61 :-) |
192a65d to
a7751f1
Compare
|
Hoy, I just tested it with the project in question, and it removes the duplicate dependencies (the Thank you for your time and the work you put into this crate! |
Great to hear! Thank you for the contribution! |
|
I've just published |
|
It is somewhat dangerous to do this. Cargo will pick the latest available compatible version, so it is possible that hypothetical 0.123 will introduce breaking changes and this crate will stop compiling completely. I'd recommend to have both upper and lower bounds on the version that are known to all work. This is what many crates seem to be doing with |
I will never recheck the versions with which it works and doesn't. I would expect a feedback with someone saying it breaks, or CI failing in the future. Maybe it is a good idea to add there a nightly job that also updates the dependencies. I have shot myself in the foot many more times when a crate I wanted to use either couldn't work with the dependency I wanted (usually newer), or pulling in the one that polluted the whole dependency tree. |
|
Well, this PR is the example of shooting in the foot: it will likely break at some point in the future. This is IMO significantly worse than pulling an extra dependency. If someone needs a newer version of As is, this is a ticking bomb waiting to break downstream projects. simple |
https://github.com/iddm/thread-priority/actions/runs/27461889160 Lower bounds (>=) are good because they're provable - we compile against the floor - but set them to the true minimum the code needs, or we cause duplication the other way. Speculative upper bounds (<) are bad: one can't prove a not-yet-released version breaks the crate depending on it, and on a huge crate like windows an over-tight cap forces duplicate copies. The "no upper bound" is also unprovable, though; this is why I created a nightly job whose goal is to catch a breaking release within a day, so it becomes possible to add a proven cap in a patch. This crate uses a tiny subset of the interface of the |
No, you're not because this repo doesn't have a lock file. This PR specifies
And that is precisely the problem. By the time you detect it, downstream users are already suffering and will not stop suffering unless they upgrade this crate too. The correct way to approach this is to have both lower and upper bound, ensuring everything within range is guaranteed to compile, here is an example from a popular crate: [target.'cfg(windows)'.dependencies.windows]
version = ">=0.53, <=0.62"
features = [
"Win32_Graphics_Direct3D12",
"Win32_Graphics_Dxgi_Common",
]
optional = trueIn case of this PR, it should have been If you don't have an upper bound, you're just waiting for trouble to happen. It may or may not happen, but it is still a bad practice to have open-ended version bounds. |
Why
In my project, I've other dependencies that depend on 0.62,
thread-prioritydepends on 0.61, this results in duplicatewindowsdeps, which increases the size of my binary, and my compilation time.Testing
I tested the change on my Windows machine running
cargo test, all tests pass.Breaking
Depending on whether this crate re-exports or exposes types from
windows, this may be a breaking change.Cheers :)