Skip to content

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

Merged
merged 1 commit into from
Aug 2, 2018
Merged

Conversation

Mark-Simulacrum
Copy link
Member

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.

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
Copy link
Member

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


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.
Copy link
Member

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?


[`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

Copy link
Member

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"


[`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

Copy link
Member

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


Several new APIs were stabilized this release:

- [`Iterator::step_by`]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually try to

  1. group similar apis in a single bullet
  2. leave a short description of what the api does

writing this is the worst part of writing these blog posts :)

@Mark-Simulacrum
Copy link
Member Author

Okay, updated.


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`,
Copy link
Member

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

error: invalid format string: expected `'}'`, found `'_'`
|
2 | format!("{_foo}", _foo = 6usize);
| ^^^^^^^^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

@sgrif sgrif Aug 1, 2018

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

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
Copy link
Contributor

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>>?

Copy link
Member

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

Copy link
Contributor

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.


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
Copy link
Contributor

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

@Mark-Simulacrum
Copy link
Member Author

I've pushed up an update -- @sgrif, can you tell me if that helps clarify things?

@sgrif
Copy link
Contributor

sgrif commented Aug 2, 2018

Yes, I think it's much more clear now

@Mark-Simulacrum Mark-Simulacrum merged commit 19320c5 into rust-lang:gh-pages Aug 2, 2018
@Mark-Simulacrum Mark-Simulacrum deleted the 1.28.0 branch August 2, 2018 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants