How to force upstream dependencies to be fixed versions?

In one of my projects, I used pixel-canvas, which depends on glium which dependents on glutin which depends on winit which depends on objc. So, the dependency will be my_project->pixel_canvas->glium->glutin->winit->objc. When I try to compile my code using beta rustc on my MacBook Pro M1, there is a compile error(mismatched types) with winit due to the change of objc, and this error has been fixed in main branch of winit but not released.

Can I somehow change the Cargo.toml of my project to force the compiler to use the latest version of winit so to pass the compilation?

I have tried this in the Cargo.toml of my project and then done cargo update, but the problem remained unresolved.

winit = { git = "" }

pixel-canvas = "0.2.1"

FYI, the issue of winit is here.

A patch is only used when the version to which the crate would resolve to if there wasn't a patch matches the version as specified in the patched in crate. If this is not the case, there should be a warning and the patch is not used.

I see. So I check the Cargo.lock and see that winit 0.21 is used but my patch is 0.23. How can I force Cargo to use my patch in this case? Thanks!

pixel-canvas = "0.2.1"
winit = { git = "" }

Try making it a normal dependency, I think this is how I solved a similar issue in the past, you don't have to use winit, just have it listed.

The problem here is that pixel-canvas depends on a winit version that doesn't work on ARM macOS.

Not working :broken_heart:

Oh, I'm not sure how to fix that, I thought adding the git dep would force cargo to pick the git dep, because it has the latest version. But maybe that only works with deps.

Yes, I checked the dependency tree just now........... fixed it with local pixel-canvas with newer glium dependency. Thanks!

But it still cannot compile because of another break in winit which has not been released nor merged in main :broken_heart: The related issue is here