3 ms·
The 1.0 release still feels like it was just yesterday. :) As with any mention of Rust 2018 and the rustfix tool, I want to emphasize how seriously compatibili
by kibwen 9y ago
The 1.0 release still feels like it was just yesterday. :)
As with any mention of Rust 2018 and the rustfix tool, I want to emphasize how seriously compatibility is being taken:
> You can use old editions indefinitely on new compilers; editions are opt-in.
> Editions are set on a per-crate basis and can be mixed and matched; you can be on a different edition from your dependencies.
> Warning-free code in one edition must compile, and have the same behavior, on the next.
> Edition-related warnings, e.g. that an identifier will become a keyword in the next edition, must be easily fixable via an automated migration tool (rustfix). Only a small minority of crates should require any manual work to opt in to a new edition, and that manual work must be minimal.
> Most new features are edition-independent, and will be usable on new compilers even when an older edition is selected.
https://blog.rust-lang.org/2018/03/12/roadmap.html https://blog.rust-lang.org/2018/03/12/roadmap.html
- rascul 9y ago> Most new features are edition-independent, and will be usable on new compilers even when an older edition is selected. What happens when you have specified an older edition, but use a feature from a newer edition (possibly without realizing it's from a newer edition), it works fine on your newer edition compiler, then try and build it on a compiler supporting only the older edition? Is that a potential issue or am I interpreting it incorrectly? It kinda seems like maybe features should be edition dependent.
- steveklabnik 9y agoIt's not 100% clear to me what you're seeing as the issue here. > but use a feature from a newer edition (possibly without realizing it's from a newer edition) You'd have to specify the newer edition for it to work. > try and build it on a compiler supporting only the older edition? This is kind of a moot point given that there's only one real compiler right now, but it would fail to compile.
- rascul 9y ago> You'd have to specify the newer edition for it to work. That seems to contradict this: > Most new features are edition-independent, and will be usable on new compilers even when an older edition is selected. I understand it's currently a moot point, I'm just trying to understand if I'm interpreting it correctly.
- steveklabnik 9y agoIf it's an edition-independent feature, then it doesn't require the newer edition, so a compiler that doesn't support the new edition wouldn't have any problems. Maybe it would help to step through a strawman? Let's say that "impl Trait" didn't land last week, but lands six months from now, after the 2018 edition ships. Alice is working on a library project using the 2015 edition. She uses "impl Trait". Since it doesn't require the 2018 edition, it just works. Bob uses Alice's library, and uses a compiler that doesn't support Rust 2018. That's fine, as Alice hasn't used any 2018 specific things. That's my understanding of the scenario you're talking about. Did I get it right? The other scenario would be this: It's 2019. Alice is working on a library project using the 2015 edition. She tries to use the "catch" keyword, which requires edition 2018. When she tries to use it, her code will fail to compile. She has two choices: 1. not use the feature 2. update to edition 2018. If she chooses the latter, when Bob tries to use her library later, but his compiler doesn't support the 2018 edition, it will fail to compile. This is basically all of the usual backwards and forwards compatibility stuff, even without editions. If you try to use ? on a 1.0 version of rustc, your code won't compile, as that was added much later.
- rascul 9y agoThank you for the explanation, I believe I understand it now. I had originally interpreted that in a manner to assume that all new features would be tagged with an edition but would be usable on older editions if the compiler supported the feature, but with your explanation I realized that my interpretation of "edition-independent" was off the mark.
- 9y ago