You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2021-10-21-Rust-1.56.0.md
+13-12
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: The Rust Release Team
5
5
release: true
6
6
---
7
7
8
-
The Rust team is happy to announce a new version of Rust, 1.56.0, and "Rust 2021" as well.
8
+
The Rust team is happy to announce a new version of Rust, 1.56.0. This stabilizes the 2021 edition as well.
9
9
Rust is a programming language empowering everyone to build reliable and efficient software.
10
10
11
11
If you have a previous version of Rust installed via rustup, getting Rust 1.56.0 is as easy as:
@@ -26,29 +26,30 @@ from the appropriate page on our website, and check out the
26
26
### Rust 2021
27
27
28
28
We wrote about plans for Rust 2021 [in May](https://blog.rust-lang.org/2021/05/11/edition-2021.html).
29
-
This is a smaller step for an edition, especially compared to 2018, but there
29
+
This a smaller edition, especially compared to 2018, but there
30
30
are still some nice quality-of-life changes that require an edition opt-in to
31
31
avoid breaking some corner cases in existing code. See the new chapters of the
32
32
edition guide below for more details on each new feature and guidance for
33
33
migration.
34
34
35
-
*[Additions to the prelude](https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html): `TryInto`, `TryFrom`, and `FromIterator`.
36
-
*[Default Cargo feature resolver](https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html) is now version 2.
37
-
*[`IntoIterator` for arrays](https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html) now includes `array.into_iter()` calls.
38
35
*[Disjoint capture in closures](https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-capture-in-closures.html) rather than always capturing whole identifiers.
36
+
*[`IntoIterator` for arrays](https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html) now includes `array.into_iter()` calls.
37
+
*[Or patterns in macro-rules](https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html) now match top-level `A|B` in `:pat`.
38
+
*[Default Cargo feature resolver](https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html) is now version 2.
39
+
*[Additions to the prelude](https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html): `TryInto`, `TryFrom`, and `FromIterator`.
39
40
*[Panic macro consistency](https://doc.rust-lang.org/edition-guide/rust-2021/panic-macro-consistency.html) now always uses `format_args!(..)`, just like `println!()`.
40
41
*[Reserving syntax](https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html) for `ident#`, `ident"..."`, and `ident'...'`.
41
42
*[Warnings promoted to errors](https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html): `bare_trait_objects` and `ellipsis_inclusive_range_patterns`.
42
-
*[Or patterns in macro-rules](https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html) now match top-level `A|B` in `:pat`.
43
43
44
44
#### Disjoint capture in closures
45
45
46
46
Closures automatically capture values or references to identifiers that are
47
-
used in the body, but before 2021, they were always captured in whole. The new
48
-
disjoint-capture feature will likely simply the way you write closures, so
47
+
used in the body, but before 2021, they were always captured as a whole. The new
48
+
disjoint-capture feature will likely simplify the way you write closures, so
49
49
let's look at a quick example:
50
50
51
51
```rust
52
+
// 2015 or 2018 edition code
52
53
leta=SomeStruct::new();
53
54
54
55
drop(a.x); // Move out of one field of the struct
@@ -67,19 +68,19 @@ above example will compile fine!
67
68
This new behavior is only activated in the new edition, since it can change
68
69
the order in which fields are dropped. As for all edition changes, an
69
70
automatic migration is available, which will update your closures for which
70
-
this matters. It can insert`let _ = &a;` inside the closure to force the
71
+
this matters by inserting`let _ = &a;` inside the closure to force the
71
72
entire struct to be captured as before.
72
73
73
74
#### Migrating to 2021
74
75
75
76
The guide includes migration instructions for all new features, and in general
76
-
[transitioning an existing project to a new edition](https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html),
77
+
[transitioning an existing project to a new edition](https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html).
77
78
In many cases `cargo fix` can automate the necessary changes. You may even
78
79
find that no changes in your code are needed at all for 2021!
79
80
80
81
However small this edition appears on the surface, it's still the product
81
-
of a lot of hard work from many contributors. Please join us in
82
-
[celebration and thanks](https://github.com/rust-lang/rust/issues/88623)!
82
+
of a lot of hard work from many contributors: see our dedicated
83
+
[celebration and thanks](https://github.com/rust-lang/rust/issues/88623) tracker!
0 commit comments