8 ms·
But Rust has editions. That is a big lever language designers can use if they painted themselves into a corner.
by virtualritz 1mo ago
But Rust has editions.
That is a big lever language designers can use if they painted themselves into a corner.
- yccs27 1mo agoYes, editions are a great mechanism. It still has its limits, especially if you want easy edition migrations. All existing Rust code assumes it can drop any type whenever it wants, and that is not something you can just change across editions. You have to be very careful with defaults if you don't want conflicts when crossing edition boundaries.
- simonask 1mo agoThe naïve idea would be to just say that all generic parameters have an implicit `where T: Move` bound, and you have to explicitly opt out of it with `where T: ?Move`, just like with `?Sized`. In fact, that's exactly how I would expect it to work, but there may be non-obvious drawbacks.
- Dagonfly 1mo agoThe compat issue has always been associated types on std traits. For example, should Iterator::Item be Move or ?Move If you leave it as Move, you can't create any iterators over !Move types. If you change it to ?Move, then functions using generic iterators can't assume that the elements of an Iterator are always moveable. Which is a breaking change compared to now. The most critical trait is probably Deref. Using !Move types without `Deref::Target: ?Move` is painful, because calling any method on boxed types relies on Deref.
- simonask 1mo agoI'm very probably missing something, but as a user I would definitely expect `Iterator::Item: Move`, but then also that `&{mut} T: Move where T: ?Move`. But yeah I can see how these bounds are somewhat viral. Thanks!
- Dagonfly 1mo agoHere is an example of the problem: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=c4e2a17964a92c19db33e1169e2806b8 https://play.rust-lang.org/?version=stable&mode=debug&editio... Imagine if MyTrait comes from core/std. Adding an opt-out bound like ?Sized (or ?Move) is a breaking change for any generic code that relies on Sized/Move. But you want some traits from std to be open for !Move types.
- ameliaquining 1mo agoThe people working on this are aware that it poses backcompat problems that don't have obvious solutions. They are looking into non-obvious solutions. https://lcnr.de/blog/2025/11/28/implicit-auto-traits-assoc-types.html https://lcnr.de/blog/2025/11/28/implicit-auto-traits-assoc-t... is the most up-to-date one I'm currently aware of.
- yoshuaw 1mo agoNiko Matsakis (T-Lang) has since also published a post on only-bounds: https://smallcultfollowing.com/babysteps/blog/2026/06/09/only-bounds https://smallcultfollowing.com/babysteps/blog/2026/06/09/onl.... Sized hierarchy, Move, and Forget/Leak all share the same fundamental compat issues, so we're all pretty motivated to solve the underlying problems in a way that enables all the other features to be built on top.
- ameliaquining 1mo agoI had read that post, but IIUC it doesn't address the kind of backcompat issues that I meant to be referring to (the ones that would apply even if there was only ever going to be one new question-mark trait).
- pjmlp 1mo agoEditions are limited, there is this urban myth they can do anything regarding language evolution, but that isn't the case. First of all they don't apply to the standard library currently, secondly the kind of automatic changes that are enabled and supported by rust fix, are limited. It is not anything goes.