I wasn’t aware that an early edition of rust can reference crates for a later edition. It doesn’t seem that terrible to prohibit this (Probably some very good reason to counter this though!). Editions give us the privilege of not having to constantly update crates that don’t really need to be changed whenever a new rust version comes out. If I do end up making changes to my crate and updating my dependencies then I don’t see it as such a pain to update the Rust Edition of my crate if said dependencies also happen to use a later edition.
I do, however, see one downside to this though and experienced it first hand in c# .net standard where it was way better to use the earliest version possible of .net standard for your library to maximise compatibility with things that use it. No incentive to use a later standard and therefore there was stagnation. May not be applicable because you normally distribute compiled binaries but food for thought.
The simple reason is that the whole point of editions is that you absolutely do not have to worry about which one you choose. They are entirely localized to your crate, and code written in any edition can interact with code written in any other edition. With your suggestion, updating the edition used by a library crate would suddenly make it unusable for all code using an older edition.
> After a few more minutes thought:
> When you upgraded `foo` from 2021 to 2024, `cargo fix` would have had to add a `Leak` bound to the parameter on the method. Removing that bound would be a breaking change. Therefore, the issue could actually be in `bar`. But this also highlights another issue: it's a breaking change to start allowing `!Leak` types to be passed to any generic method of a trait, even with this firewall. That means like `Iterator::map` can't take a closure which has a `!Leak` type in its state, for example.
> But also what is the issue in `bar` if so? In 2021 edition, the interface of any trait you impl coming from a 2024 edition crate is tested under 2024 edition somehow? Does that work? What does the error message say to you?
> My point is not that this is impossible, but that its not easy at all.
https://www.reddit.com/r/rust/comments/16ltgn1/comment/k145i...