@@ -31,7 +31,7 @@ information.
31
31
32
32
#### The ` dbg ` macro
33
33
34
- First up, a quality of life improvement. Are you a "printf debugger"? If you are, and
34
+ First up, a quality of life improvement. Are you a "print debugger"? If you are, and
35
35
you've wanted to print out some value while working on some code, you have to do this:
36
36
37
37
``` rust
@@ -67,7 +67,7 @@ If you run this program, you'll see:
67
67
You get the file and line number of where this was invoked, as well as the
68
68
name and value. Additionally, ` println! ` prints to the standard output, so
69
69
you really should be using ` eprintln! ` to print to standard error. ` dbg! `
70
- does the right thing and goes to ` stderr ` by default .
70
+ does the right thing and goes to ` stderr ` .
71
71
72
72
It even works in more complex circumstances. Consider this factorial example:
73
73
@@ -160,8 +160,8 @@ Long, long ago, Rust had a large, Erlang-like runtime. We chose to use
160
160
[ jemalloc] instead of the system allocator, because it often improved
161
161
performance over the default system one. Over time, we shed more and more of
162
162
this runtime, and eventually almost all of it was removed, but jemalloc
163
- didn't . We didn't have a way to choose a custom allocator, and so we couldn't
164
- really remove it without causing a regression for people who do need
163
+ was not . We didn't have a way to choose a custom allocator, and so we
164
+ couldn't really remove it without causing a regression for people who do need
165
165
jemalloc.
166
166
167
167
Also, saying that ` jemalloc ` was always the default is a bit UNIX-centric,
@@ -232,11 +232,12 @@ already-existing `*` for "zero or more" and `+` for "one or more."
232
232
233
233
#### Final module improvements
234
234
235
- In Rust 1.30.0, [ we announced several improvements to the module
236
- system] ( https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#module-system-changes ) .
237
- We have one last tweak landing in 1.32.0 and the 2018 edition. Nicknamed
238
- [ "uniform paths"] ( https://github.com/rust-lang/rust/pull/56759/ ) , the simplest way to explain
239
- it is to show you this code:
235
+ In the past two releases, we announced several improvements to the module
236
+ system. We have one last tweak landing in 1.32.0 and the 2018 edition.
237
+ Nicknamed [ "uniform
238
+ paths"] ( https://github.com/rust-lang/rust/pull/56759#issuecomment-450051210 ) ,
239
+ it permits previously invalid import path statements to be resolved exactly
240
+ the same way as non-import paths. For example:
240
241
241
242
``` rust
242
243
enum Color { Red , Green , Blue }
@@ -245,19 +246,25 @@ use Color::*;
245
246
```
246
247
247
248
This code did * not* previously compile, as ` use ` statements had to start with
248
- ` super ` , ` self ` , or ` crate ` . With this change, this code will work, and do
249
- what you probably expect: import the variants of the ` Color ` enum defined
250
- above the ` use ` statement.
249
+ ` super ` , ` self ` , or ` crate ` . Now that the compiler supports uniform paths,
250
+ this code will work, and do what you probably expect: import the variants of
251
+ the ` Color ` enum defined above the ` use ` statement.
251
252
252
253
With this change in place, we've completed our efforts at revising the module
253
254
system. We hope you've been enjoying the simplified system so far!
254
255
255
256
### Library stabilizations
256
257
257
258
We talked above about the ` dbg! ` macro, which is a big library addition.
258
- Beyond that, 19 functions were made ` const fn ` s, and all 72 combinations of
259
- the ` to_*_bytes ` and ` from_*_bytes ` methods, where ` * ` is one of `{be, le,
260
- ne}` , were added to ` {usize,isize,i8,i16,i32,i64,i128,u8,u16,u32,u64,u128}`.
259
+ Beyond that, 19 functions were made ` const fn ` s, and all integral numeric
260
+ primitives now provide conversion functions to and from byte-arrays with
261
+ specified edianness. These six functions are named ` to_<endian>_bytes ` and
262
+ ` from_<endian>_bytes ` , where ` <endian> ` is one of:
263
+
264
+ * ` ne ` - native endianness
265
+ * ` le ` - little endian
266
+ * ` be ` - big endian
267
+
261
268
See the [ detailed release notes] [ notes ] for more details.
262
269
263
270
### Cargo features
0 commit comments