4 ms·
No, editions require explicit activation and the "default" edition will remain forever at 2015, i.e. Rust 1.0. This is in contrast to C and C++ compilers like
by heftig 5y ago
No, editions require explicit activation and the "default" edition will remain forever at 2015, i.e. Rust 1.0.
This is in contrast to C and C++ compilers like GCC and Clang, where the default "std" setting is often updated with new releases.
- cesarb 5y ago> No, editions require explicit activation and the "default" edition will remain forever at 2015, i.e. Rust 1.0. With the slight caveat that this is the "default if not specified", but the default when creating a new project with "cargo new" is to specify the currently latest version on the generated Cargo.toml file. That is, there are two defaults: the default for pre-edition projects (forever 2015), and the default for creating a new project (sets the project to what was the latest edition when the "cargo new" was run).
- dathinab 5y agoI believe it's not a caveat at all. I mean you can mix and match dependencies of different editions, and there are (IMHO) very few reasons to start a new project with an old editions. For that (IMHO) very few reasons you tend to be aware of you intentionally wanting to use a old version and as such it's not a problem. Through I would say there is no real default rust editions, it's more appropriate to say crates/libraries "keep" the rust edition they where created with until explicitly changed.
- gpderetta 5y agoWell, AFAIK rust versions are not backward compatible, while C and C++ standars for the most part are.
- zanellato19 5y agoThey are, that's the whole point
- steveklabnik 5y agoThere is small breakage in new versions of both C and C++’s standards. It is generally very small though.
- dathinab 5y agoHappens in rust, too. Mainly to fix soundness holes in the language. Like there was some problem with match statements, guards, moving values and potential (I think?) user after free or so. Which required match guards to be slightly constrained in some edge cases.
- dathinab 5y agoYou might confuse rust version with rust editions. Version: 1.0.0,.., 1.50.0, 1.51.0, ... Edition: 2015, 2018, .. Versions are the compiler version you use. Editions are more like a language dialect, and all newer compilers support all "older" editions. What versions change tend to be: - config defaults, e.g. make some warnings errors, change the default dep. resolver, etc. - syntax (in minor ways). E.g. add a new keyword for a new feature/syntax or remove a reversed but unused keyword where it's no clear that it's not needed. - improvements the the borrow checker or import system which in some edge cases could break existing code. Anyway any rust version supports all editions released up to the point in time and you can freely mix and match them between dependencies.
- gpderetta 5y agosorry, yes, I meant edition, as per parent post.