Skip to content

Commit b4d8afa

Browse files
1.28.0 blog post
1 parent 749f41f commit b4d8afa

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed

_posts/2018-08-02-Rust-1.28.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.28"
4+
author: The Rust Core Team
5+
---
6+
7+
The Rust team is happy to announce a new version of Rust, 1.28.0. Rust is a
8+
systems programming language focused on safety, speed, and concurrency.
9+
10+
If you have a previous version of Rust installed via rustup, getting Rust
11+
1.28.0 is as easy as:
12+
13+
```bash
14+
$ rustup update stable
15+
```
16+
17+
If you don't have it already, you can [get `rustup`][install] from the
18+
appropriate page on our website, and check out the [detailed release notes for
19+
1.28.0][notes] on GitHub.
20+
21+
[install]: https://www.rust-lang.org/install.html
22+
[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1280-2018-08-02
23+
24+
## What's in 1.28.0 stable
25+
26+
### Global Allocators
27+
28+
1.28.0 adds the `#[global_allocator]` attribute, which allows Rust programs to
29+
set their allocator, as well as define new allocators by implementing the
30+
[`GlobalAlloc`] trait.
31+
32+
By default, Rust uses jemalloc on Linux systems, but this may not be ideal for
33+
specific use cases. The standard library provides a method for switching to the
34+
system allocator:
35+
36+
```rust
37+
use std::alloc::System;
38+
39+
#[global_allocator]
40+
static GLOBAL: System = System;
41+
42+
fn main() {
43+
let mut v = Vec::new();
44+
// This will allocate memory using the system allocator.
45+
v.push(1);
46+
}
47+
```
48+
49+
However, sometimes you want to define a custom allocator for a given application
50+
domain. This is also relatively easy to do by implementing the `GlobalAlloc`
51+
trait. You can read more about how to do this in the [documentation].
52+
53+
[`GlobalAlloc`]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html
54+
[documentation]: https://doc.rust-lang.org/1.28.0/std/alloc/trait.GlobalAlloc.html
55+
56+
### Library stabilizations
57+
58+
Several new APIs were stabilized this release:
59+
60+
- [`Iterator::step_by`]
61+
- [`Path::ancestors`]
62+
- [`SystemTime::UNIX_EPOCH`]
63+
- [`alloc::GlobalAlloc`]
64+
- [`alloc::Layout`]
65+
- [`alloc::LayoutErr`]
66+
- [`alloc::System`]
67+
- [`alloc::alloc`]
68+
- [`alloc::alloc_zeroed`]
69+
- [`alloc::dealloc`]
70+
- [`alloc::realloc`]
71+
- [`alloc::handle_alloc_error`]
72+
- [`btree_map::Entry::or_default`]
73+
- [`fmt::Alignment`]
74+
- [`hash_map::Entry::or_default`]
75+
- [`iter::repeat_with`]
76+
- [`num::NonZeroUsize`]
77+
- [`num::NonZeroU128`]
78+
- [`num::NonZeroU16`]
79+
- [`num::NonZeroU32`]
80+
- [`num::NonZeroU64`]
81+
- [`num::NonZeroU8`]
82+
- [`ops::RangeBounds`]
83+
- [`slice::SliceIndex`]
84+
- [`slice::from_mut`]
85+
- [`slice::from_ref`]
86+
- [`{Any + Send + Sync}::downcast_mut`]
87+
- [`{Any + Send + Sync}::downcast_ref`]
88+
- [`{Any + Send + Sync}::is`]
89+
90+
See the [detailed release notes][notes] for more.
91+
92+
[`Iterator::step_by`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.step_by
93+
[`Path::ancestors`]: https://doc.rust-lang.org/std/path/struct.Path.html#method.ancestors
94+
[`SystemTime::UNIX_EPOCH`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#associatedconstant.UNIX_EPOCH
95+
[`alloc::GlobalAlloc`]: https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html
96+
[`alloc::Layout`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html
97+
[`alloc::LayoutErr`]: https://doc.rust-lang.org/std/alloc/struct.LayoutErr.html
98+
[`alloc::System`]: https://doc.rust-lang.org/std/alloc/struct.System.html
99+
[`alloc::alloc`]: https://doc.rust-lang.org/std/alloc/fn.alloc.html
100+
[`alloc::alloc_zeroed`]: https://doc.rust-lang.org/std/alloc/fn.alloc_zeroed.html
101+
[`alloc::dealloc`]: https://doc.rust-lang.org/std/alloc/fn.dealloc.html
102+
[`alloc::realloc`]: https://doc.rust-lang.org/std/alloc/fn.realloc.html
103+
[`alloc::handle_alloc_error`]: https://doc.rust-lang.org/std/alloc/fn.handle_alloc_error.html
104+
[`btree_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
105+
[`fmt::Alignment`]: https://doc.rust-lang.org/std/fmt/enum.Alignment.html
106+
[`hash_map::Entry::or_default`]: https://doc.rust-lang.org/std/collections/btree_map/enum.Entry.html#method.or_default
107+
[`iter::repeat_with`]: https://doc.rust-lang.org/std/iter/fn.repeat_with.html
108+
[`num::NonZeroUsize`]: https://doc.rust-lang.org/std/num/struct.NonZeroUsize.html
109+
[`num::NonZeroU128`]: https://doc.rust-lang.org/std/num/struct.NonZeroU128.html
110+
[`num::NonZeroU16`]: https://doc.rust-lang.org/std/num/struct.NonZeroU16.html
111+
[`num::NonZeroU32`]: https://doc.rust-lang.org/std/num/struct.NonZeroU32.html
112+
[`num::NonZeroU64`]: https://doc.rust-lang.org/std/num/struct.NonZeroU64.html
113+
[`num::NonZeroU8`]: https://doc.rust-lang.org/std/num/struct.NonZeroU8.html
114+
[`ops::RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
115+
[`slice::SliceIndex`]: https://doc.rust-lang.org/std/slice/trait.SliceIndex.html
116+
[`slice::from_mut`]: https://doc.rust-lang.org/std/slice/fn.from_mut.html
117+
[`slice::from_ref`]: https://doc.rust-lang.org/std/slice/fn.from_ref.html
118+
[`{Any + Send + Sync}::downcast_mut`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_mut-2
119+
[`{Any + Send + Sync}::downcast_ref`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.downcast_ref-2
120+
[`{Any + Send + Sync}::is`]: https://doc.rust-lang.org/std/any/trait.Any.html#method.is-2
121+
122+
### Cargo features
123+
124+
[Cargo will now no longer allow you to publish crates with build scripts that
125+
modify the `src` directory.][cargo/5584] The `src` directory in a crate should be
126+
considered to be immutable.
127+
128+
[cargo/5584]: https://github.com/rust-lang/cargo/pull/5584/
129+
130+
## Contributors to 1.28.0
131+
132+
Many people came together to create Rust 1.28. We couldn't have done it
133+
without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.28.0)

0 commit comments

Comments
 (0)