@@ -35,7 +35,7 @@ In Rust, this code is synonymous with:
35
35
36
36
``` rust
37
37
let _x = 5 ;
38
- let x = & x ;
38
+ let x = & _x ;
39
39
```
40
40
41
41
That is, the ` 5 ` here will be stored on the stack, or possibly in registers.
@@ -111,19 +111,19 @@ the platform we build the documentation on. We've long regretted that the hosted
111
111
version of the documentation has been Linux-specific; this is a first step towards
112
112
rectifying that. This is [ specific to the standard
113
113
library] ( https://github.com/rust-lang/rust/pull/43348 ) and not for general use;
114
- we'll hope to improve this further in the future.
114
+ we hope to improve this further in the future.
115
115
116
116
Next, [ Cargo's docs are moving!] ( https://github.com/rust-lang/rust/pull/43916 )
117
117
Historically, Cargo's docs were hosted on doc.crates.io, which doesn't follow
118
- the release train model, even though Cargo itself does. This lead to situations
118
+ the release train model, even though Cargo itself does. This led to situations
119
119
where a feature would land in Cargo nightly, the docs would be updated, and
120
120
then for up to twelve weeks, users would * think* that it should work, but it
121
121
wouldn't yet. [ https://doc.rust-lang.org/cargo ] ( https://doc.rust-lang.org/cargo )
122
122
will be the new home of Cargo's docs, though for now, that URL is a redirect to
123
123
doc.crates.io. Future releases will move Cargo's docs over, and at that point,
124
124
doc.crates.io will redirect to doc.rust-lang.org/cargo. Cargo's docs have long
125
125
needed a refreshing, so expect to hear more news about Cargo's docs generally
126
- through the end of the year.
126
+ in the future!
127
127
128
128
Finally, until now, ` rustdoc ` did not have any documentation. This is now
129
129
[ fixed] ( https://github.com/rust-lang/rust/pull/43863 ) , with a new "` rustdoc `
@@ -146,13 +146,50 @@ recently](https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics
146
146
which may help with this situation. That change has yet to be implemented, however,
147
147
though pre-requisite work is ongoing at the moment.
148
148
149
+ Next, [ ` Iterator::for_each ` ] ( https://github.com/rust-lang/rust/pull/44567 ) has
150
+ been stabilized, letting you consume an iterator for side effects without needing
151
+ a ` for ` loop:
152
+
153
+ ``` rust
154
+ // old
155
+ for i in 0 .. 10 {
156
+ println! (" {}" , i );
157
+ }
158
+
159
+ // new
160
+ (0 .. 10 ). for_each (| i | println! (" {}" , i ));
161
+ ```
162
+
163
+ The correct one to use depends on your situation; in the sample above, the ` for ` loop
164
+ is pretty striaghtforward. But when you're chaining a number of iterators together,
165
+ the ` for_each ` version is sometimes clearer. Consider this:
166
+
167
+ ``` rust
168
+ // old
169
+ for i in (0 .. 100 ). map (| x | x + 1 ). filter (| x | x % 2 == 0 ) {
170
+ println! (" {}" , i );
171
+ }
172
+
173
+ // new
174
+ (0 .. 100 )
175
+ . map (| x | x + 1 )
176
+ . filter (| x | x % 2 == 0 )
177
+ . for_each (| i | println! (" {}" , i ));
178
+ ```
179
+
149
180
[ ` Rc<T> ` and ` Arc<T> ` now implement ` From<&[T]> where T: Clone ` , ` From<str> ` ,
150
181
` From<String> ` , ` From<Box<T>> where T: ?Sized ` , and
151
182
` From<Vec<T>> ` .] ( https://github.com/rust-lang/rust/pull/42565 )
152
183
184
+ The [ ` max ` and ` min ` functions on the ` Ord `
185
+ trait] ( https://github.com/rust-lang/rust/pull/44593 ) are now stable.
186
+
187
+ The [ ` needs_drop ` intrinsic] ( https://github.com/rust-lang/rust/pull/44639 )
188
+ is now stable.
189
+
153
190
Finally, [ ` std::mem::discriminant ` has been
154
191
stabilized] ( https://doc.rust-lang.org/std/mem/fn.discriminant.html ) , allowing
155
- you to see what variant an ` enum ` is .
192
+ you to see what variant an ` enum ` instance is without a ` match ` statement .
156
193
157
194
See the [ detailed release notes] [ notes ] for more.
158
195
0 commit comments