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
+11-8
Original file line number
Diff line number
Diff line change
@@ -32,12 +32,12 @@ 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
-
*[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.
35
+
*[Disjoint capture](https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-capture-in-closures.html): closures now capture individual named fields rather than always capturing whole identifiers.
36
+
*[`IntoIterator` for arrays](https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html): `array.into_iter()`now iterates over items by value instead of by reference.
37
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
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`.
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!()`.
39
+
*[Additions to the prelude](https://doc.rust-lang.org/edition-guide/rust-2021/prelude.html): `TryInto`, `TryFrom`, and `FromIterator` are now in scope by default.
40
+
*[Panic macros](https://doc.rust-lang.org/edition-guide/rust-2021/panic-macro-consistency.html) now always expect format strings, just like `println!()`.
41
41
*[Reserving syntax](https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html) for `ident#`, `ident"..."`, and `ident'...'`.
42
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`.
43
43
@@ -52,11 +52,14 @@ let's look at a quick example:
52
52
// 2015 or 2018 edition code
53
53
leta=SomeStruct::new();
54
54
55
-
drop(a.x); // Move out of one field of the struct
55
+
// Move out of one field of the struct
56
+
drop(a.x);
56
57
57
-
println!("{}", a.y); // Ok: Still use another field of the struct
58
+
// Ok: Still use another field of the struct
59
+
println!("{}", a.y);
58
60
59
-
letc=||println!("{}", a.y); // Error: Tries to capture all of `a`
61
+
// Error: Before 2021 edition, tries to capture all of `a`
62
+
letc=||println!("{}", a.y);
60
63
c();
61
64
```
62
65
@@ -174,6 +177,6 @@ and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#r
174
177
175
178
### Contributors to 1.56.0
176
179
177
-
Many people came together to create Rust 1.56.0.
180
+
Many people came together to create Rust 1.56.0 and the 2021 edition.
0 commit comments