Skip to content

Commit 0af2ce3

Browse files
committed
Small updates.
1 parent 5590537 commit 0af2ce3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

posts/2021-04-30-edition-2021.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,20 @@ However, this is simply not possible.
152152
You can't have a trait implementation exist in one edition and not in another,
153153
since editions can be mixed.
154154

155-
Instead, we decided to add the trait implementation in all editions (starting in Rust 1.53.0),
155+
Instead, we decided to add the trait implementation in *all* editions (starting in Rust 1.53.0),
156156
but add a small hack to avoid breakage until Rust 2021.
157157
In Rust 2015 and 2018 code, the compiler will still resolve `array.into_iter()`
158158
to `(&array).into_iter()` like before, as if the trait implementation does not exist.
159159
This *only* applies to the `.into_iter()` method call syntax.
160-
It does not affect any other syntax such as `for e in [1, 2, 3]` or `iter.zip([1, 2, 3])`.
160+
It does not affect any other syntax such as `for e in [1, 2, 3]`, `iter.zip([1, 2, 3])` or
161+
`IntoIterator::into_iter([1, 2, 3])`.
161162
Those will start to work in *all* editions.
162163

163164
While it's a shame that this required a small hack to avoid breakage,
164165
we're very happy with how this solution keeps the difference between
165166
the editions to an absolute minimum.
167+
Since the hack is only present in the older editions,
168+
there is no added complexity in the new edition.
166169

167170
[25]: https://github.com/rust-lang/rust/issues/25725
168171
[20]: https://github.com/rust-lang/rust/pull/65819
@@ -248,7 +251,7 @@ To make space for some new syntax in the future,
248251
we've decided to reserve syntax for prefixed identifiers and literals:
249252
`prefix#identifier`, `prefix"string"`, `prefix'c'`, and `prefix#123`,
250253
where `prefix` can be any identifier.
251-
(Except those that already have a meaning, such as `b''` and `r""`.)
254+
(Except those that already have a meaning, such as `b''` and `r""`.)
252255

253256
This is a breaking change, since macros can currently accept `hello"world"`,
254257
which they will see as two separate tokens: `hello` and `"world"`.

0 commit comments

Comments
 (0)