Skip to content

Commit 62bc375

Browse files
committed
What is rust 2018
1 parent 3b29132 commit 62bc375

File tree

1 file changed

+146
-0
lines changed

1 file changed

+146
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
layout: post
3+
title: "What is Rust 2018?"
4+
author: The Rust Core Team
5+
---
6+
7+
Back in March, [we announced](https://blog.rust-lang.org/2018/03/12/roadmap.html) something new:
8+
9+
> This year, we will deliver Rust 2018, marking the first major new edition
10+
> of Rust since 1.0 (aka Rust 2015).
11+
>
12+
> We will continue to publish releases every six weeks as usual. But we will
13+
> designate a release in the latter third of the year (Rust 1.29 - 1.31) as Rust
14+
> 2018. This new “edition” of Rust will be the culmination of feature
15+
> stabilization throughout the year, and will ship with polished documentation,
16+
> tooling, and libraries that tie in to those features.
17+
18+
Now that some time has passed, we wanted to share more about what this actually
19+
*means* for Rust and Rust developers.
20+
21+
## Language change over time
22+
23+
One of the key questions facing language developers is "how do you manage
24+
change over time"? How does that work for your users? We believe quite
25+
strongly that language stability is of utmost importance. A language is the
26+
foundation that you build your application on top of, and you cannot build
27+
reliable, long-living things on a foundation of sand. The very second post on
28+
our blog, way back in October of 2014, was "[Stability as
29+
a](https://blog.rust-lang.org/2014/10/30/Stability.html)
30+
[Deliverable](https://blog.rust-lang.org/2014/10/30/Stability.html)". This laid
31+
out our plans for the six week release schedule that we still follow to this
32+
day. It also described how stability was important:
33+
34+
> It’s important to be clear about what we mean by stable. We don’t mean that
35+
> Rust will stop evolving. We will release new versions of Rust on a regular,
36+
> frequent basis, and we hope that people will upgrade just as regularly. But
37+
> for that to happen, those upgrades need to be painless.
38+
39+
We put in a lot of work to make upgrades painless; for example, we run a tool
40+
(called "crater") before each Rust release that downloads every package on
41+
crates.io and attempts to build their code and run their tests. We have a
42+
strong culture of testing, and we use tooling to ensure that every single
43+
pull request is tested on every platform.
44+
While we still believe that the six-week process is a fantastic *engineering*
45+
strategy, it has some flaws.
46+
47+
### Losing the big picture
48+
49+
Increasing the number of releases means that each release is smaller. That's
50+
the point! From an engineering perspective, this is great. But from a
51+
user-facing perspective, it's harder to keep track of what's going on in Rust
52+
unless you pay close attention every six weeks. And for those of us who do pay
53+
such attention, it's easy to lose sight of the big picture. Rust has come a
54+
long way in the last three years! Finally, for people who have tried Rust and
55+
stopped using it for whatever reason, it's hard to know if the concerns have
56+
been addressed: they'd have to pay attention every six weeks, which is not
57+
something that is likely to happen.
58+
59+
### Tiny but necessary changes
60+
61+
Especially in a language with static types, almost any release can contain
62+
something that breaks someone's code. Rust's
63+
[RFC](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md)
64+
[1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md)
65+
lays out what kinds of changes we can make when incrementing a major, minor, or
66+
patch version of the language. However, the concept of "2.0" is extremely
67+
overloaded in the minds of developers. 2.0 is *major* breaking change. Time to
68+
throw everything out and start again. As such, we are very wary of releasing a
69+
Rust 2.0. There are some small changes that would be nice to make without
70+
needing to bump to 2.0, however. For example, the addition of a new keyword is
71+
a breaking change. But sometimes, new features require a new keyword to work
72+
properly. In many ways, Rust is about taking tradeoffs and bending the curve.
73+
Can we have our cake and eat it too?
74+
75+
## What is Rust 2018?
76+
77+
The release of Rust 1.31.0 on December 6th will be the first release of "Rust
78+
2018." This marks a culmination of the last three years of Rust's development,
79+
and brings it together in one neat package. For example, there will be a 2018
80+
edition of the book that incorporates features stabilized since the print
81+
edition was considered finalized.
82+
83+
You'll be able to put `edition = '2018'` into your `Cargo.toml`, and `cargo
84+
new` will add it by default for new projects. At first, this will unlock
85+
some new features that are not possible without it, and eventually, it will
86+
enable some new lints that nudge you towards new idioms. You can also choose
87+
`'2015'`, and if you don't have an `edition` key at all, it will default to
88+
this value. These projects will continue on as before. We'll be shipping a
89+
tool, that helps you automatically upgrade your code to use these new features
90+
and idioms. Running `cargo fix` will get your code ready in an automated
91+
fashion.
92+
93+
From one perspective, editions are mostly about that cohesive package: they're
94+
about celebrating what we've accomplished, and telling the world about it. From
95+
another, editions are a way for us to make "breaking" changes without breaking
96+
your code. For example, `try` will become a keyword in Rust 2018. We can't
97+
make that change in Rust 2015, as it may break code that uses it as a variable
98+
name. But since you opt-in to Rust 2018, we can. We can also turn some warnings
99+
into hard errors. But these changes are extremely limited; without getting too
100+
deep into the technical details, editions can only change surface-level
101+
features; the core of Rust is still the same.
102+
103+
## Managing compatibility
104+
105+
It goes even further than that: these two universes are compatible with one
106+
another. We are quite sensitive to the issues in other language ecosystems,
107+
where new code and old code can't interoperate. Making sure that this worked
108+
well was a key aspect of the design of editions. In some sense, editions are
109+
following in the steps of Java and C++, two languages that are known for their
110+
stability stories.
111+
112+
In short, the Rust compiler will know how to compile both editions of code.
113+
This is similar to how `javac` can compile both Java 9 and Java 10, or how
114+
`gcc` and `clang` support both C++14 and C++17. Additionally, each compiler
115+
will understand how to link both kinds of code together. This means that if
116+
you're using Rust 2018, you can use dependencies that use Rust 2015 with zero
117+
problems. If you're sticking with Rust 2015, you can use libraries that use
118+
Rust 2018. It all works together. This lets people who want to use new things
119+
start immediately, while others that want to take it slower can upgrade on
120+
their own time schedule.
121+
122+
Beyond that, it’s also important to mention that this release will be the
123+
*initial* release of Rust 2018; in some sense, it’s the start, not the end.
124+
We haven’t formally committed to a schedule for editions, but it’s likely
125+
that the next one will be Rust 2021. We’ll continue to add features to Rust
126+
2018 after its release, just like we continued to add features to Rust after
127+
the Rust 1.0 release.
128+
129+
It’s also important to note that Rust 2015 is not frozen. Anything that does
130+
not *require* being a part of Rust 2018 will work on Rust 2015 as well. This is
131+
due to the way editions work; given the small nature of possible changes, the
132+
compiler uses the same internal representation for all editions.
133+
134+
## A few words on long-term support
135+
136+
The Rust project currently only supports the most recent version of the stable
137+
compiler. Some have wondered if the concept of editions ties into some form of
138+
longer support. It does not, however, we've been talking about introducing some
139+
sort of LTS policy, and may do so in the future.
140+
141+
## Giving it a try
142+
143+
We'll be doing several preview releases of Rust 2018. The most adventurous Rust
144+
users are already giving it a try on nightly; once we get feedback from them
145+
and do some polishing, we'll announce a beta that’s ready for more wide usage
146+
for you to try here on the blog.

0 commit comments

Comments
 (0)