Skip to content

Commit eb897dd

Browse files
committed
review fixes
1 parent 3ee85e3 commit eb897dd

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

posts/2019-01-17-Rust-1.32.0.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ information.
3131

3232
#### The `dbg` macro
3333

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
3535
you've wanted to print out some value while working on some code, you have to do this:
3636

3737
```rust
@@ -67,7 +67,7 @@ If you run this program, you'll see:
6767
You get the file and line number of where this was invoked, as well as the
6868
name and value. Additionally, `println!` prints to the standard output, so
6969
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`.
7171

7272
It even works in more complex circumstances. Consider this factorial example:
7373

@@ -160,8 +160,8 @@ Long, long ago, Rust had a large, Erlang-like runtime. We chose to use
160160
[jemalloc] instead of the system allocator, because it often improved
161161
performance over the default system one. Over time, we shed more and more of
162162
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
165165
jemalloc.
166166

167167
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."
232232

233233
#### Final module improvements
234234

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:
240241

241242
```rust
242243
enum Color { Red, Green, Blue }
@@ -245,19 +246,25 @@ use Color::*;
245246
```
246247

247248
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.
251252

252253
With this change in place, we've completed our efforts at revising the module
253254
system. We hope you've been enjoying the simplified system so far!
254255

255256
### Library stabilizations
256257

257258
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+
261268
See the [detailed release notes][notes] for more details.
262269

263270
### Cargo features

0 commit comments

Comments
 (0)