-
Notifications
You must be signed in to change notification settings - Fork 298
1.28.0 blog post #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.28.0 blog post #264
Conversation
_posts/2018-08-02-Rust-1.28.md
Outdated
domain. This is also relatively easy to do by implementing the `GlobalAlloc` | ||
trait. You can read more about how to do this in the [documentation]. | ||
|
||
[`GlobalAlloc`]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should link to stable not 1.28.0
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
1.28.0 adds the `#[global_allocator]` attribute, which allows Rust programs to | ||
set their allocator, as well as define new allocators by implementing the | ||
[`GlobalAlloc`] trait. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to talk a bit more about what allocators are?
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
[`GlobalAlloc`]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html | ||
[documentation]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing the boilerplate "for more see the release notes"
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
[`GlobalAlloc`]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html | ||
[documentation]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You said this post was missing something; I would possibly include rust-lang/rust#50610 here
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
Several new APIs were stabilized this release: | ||
|
||
- [`Iterator::step_by`] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually try to
- group similar apis in a single bullet
- leave a short description of what the api does
writing this is the worst part of writing these blog posts :)
Okay, updated. |
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
We've already mentioned the stabilization of the `GlobalAlloc` trait, but | ||
another important stabilization is the [`NonZero`] types. These are wrappers | ||
around the standard unsigned integer types: `u8`, `u16, `u32`, `u64`, `u128`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing the closing quote on `u16
_posts/2018-08-02-Rust-1.28.md
Outdated
error: invalid format string: expected `'}'`, found `'_'` | ||
| | ||
2 | format!("{_foo}", _foo = 6usize); | ||
| ^^^^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The carets are under "{_foo}"
. https://play.rust-lang.org/?gist=df6fd444250a1fa26df8ecb3b57017b0&version=stable
_posts/2018-08-02-Rust-1.28.md
Outdated
allocator, as well as define new allocators by implementing the [`GlobalAlloc`] | ||
trait. | ||
|
||
The standard library provides a handle to the system allocator, which can be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's worth mentioning jemalloc at some point around here? It took me a minute to realize this isn't the default behavior
_posts/2018-08-02-Rust-1.28.md
Outdated
and `usize`. | ||
|
||
This allows for size-optimization, for example, `Option<u8>` is two bytes large, | ||
but `Option<NonZeroU8>` is just one byte large. This is especially useful when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Option<NonZero<u8>>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they're separate types now, e.g.
https://doc.rust-lang.org/nightly/std/num/struct.NonZeroU8.html
But maybe that should be clarified in mentioning "the NonZero
types".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording of the previous paragraph definitely made me think that NonZero<T>
was still a thing.
_posts/2018-08-02-Rust-1.28.md
Outdated
|
||
This allows for size-optimization, for example, `Option<u8>` is two bytes large, | ||
but `Option<NonZeroU8>` is just one byte large. This is especially useful when | ||
the number represents an identifier and so you can guarantee that it is never |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something obvious, but it's not clear to me what you mean when you say "when the number represents an identifier" or how that benefits from the stabilization of NonZero
I've pushed up an update -- @sgrif, can you tell me if that helps clarify things? |
Yes, I think it's much more clear now |
r? @steveklabnik
cc @rust-lang/release
I'd appreciate feedback -- I feel like there's something missing, it'd be nice to have at least one more feature I think.