Skip to content

Commit 4aeafa5

Browse files
Merge pull request #745 from steveklabnik/rust-1.49
Blog for Rust 1.49.0
2 parents 82aa254 + 8de70e4 commit 4aeafa5

File tree

1 file changed

+196
-0
lines changed

1 file changed

+196
-0
lines changed

posts/2020-12-31-Rust-1.49.0.md

+196
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.49.0"
4+
author: The Rust Release Team
5+
release: true
6+
---
7+
8+
The Rust team is happy to announce a new version of Rust, 1.49.0. Rust is a
9+
programming language that is empowering everyone to build reliable and
10+
efficient software.
11+
12+
If you have a previous version of Rust installed via rustup, getting Rust
13+
1.49.0 is as easy as:
14+
15+
```console
16+
rustup update stable
17+
```
18+
19+
If you don't have it already, you can [get `rustup`][install] from the
20+
appropriate page on our website, and check out the [detailed release notes for
21+
1.49.0][notes] on GitHub.
22+
23+
[install]: https://www.rust-lang.org/install.html
24+
[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1490-2020-12-31
25+
26+
## What's in 1.49.0 stable
27+
28+
For this release, we have some new targets and an improvement to the test
29+
framework. See the [detailed release notes][notes] to learn about other
30+
changes not covered by this post.
31+
32+
### 64-bit ARM Linux reaches Tier 1
33+
34+
The Rust compiler supports [a wide variety of targets][platform-support], but
35+
the Rust Team can't provide the same level of support for all of them. To
36+
clearly mark how supported each target is, we use a tiering system:
37+
38+
* Tier 3 targets are technically supported by the compiler, but we don't check
39+
whether their code build or passes the tests, and we don't provide any
40+
prebuilt binaries as part of our releases.
41+
* Tier 2 targets are guaranteed to build and we provide prebuilt binaries, but
42+
we don't execute the test suite on those platforms: the produced binaries
43+
might not work or might have bugs.
44+
* Tier 1 targets provide the highest support guarantee, and we run the full
45+
suite on those platforms for every change merged in the compiler. Prebuilt
46+
binaries are also available.
47+
48+
Rust 1.49.0 promotes the `aarch64-unknown-linux-gnu` target to Tier 1 support,
49+
bringing our highest guarantees to users of 64-bit ARM systems running Linux!
50+
We expect this change to benefit workloads spanning from embedded to desktops
51+
and servers.
52+
53+
This is an important milestone for the project, since it's the first time a
54+
non-x86 target has reached Tier 1 support: we hope this will pave the way for
55+
more targets to reach our highest tier in the future.
56+
57+
Note that Android is not affected by this change as it uses a different Tier 2
58+
target.
59+
60+
[platform-support]: https://doc.rust-lang.org/stable/rustc/platform-support.html
61+
62+
### 64-bit ARM macOS and Windows reach Tier 2
63+
64+
Rust 1.49.0 also features two targets reaching Tier 2 support:
65+
66+
* The `aarch64-apple-darwin` target brings support for Rust on Apple M1 systems.
67+
* The `aarch64-pc-windows-msvc` target brings support for Rust on 64-bit ARM
68+
devices running Windows on ARM.
69+
70+
Developers can expect both of those targets to have prebuilt binaries
71+
installable with `rustup` from now on! The Rust Team is not running the test
72+
suite on those platforms though, so there might be bugs or instabilities.
73+
74+
### Test framework captures output in threads
75+
76+
Rust's built-in testing framework doesn't have a ton of features, but that
77+
doesn't mean it can't be improved! Consider a test that looks like this:
78+
79+
```rust
80+
#[test]
81+
fn thready_pass() {
82+
println!("fee");
83+
std::thread::spawn(|| {
84+
println!("fie");
85+
println!("foe");
86+
})
87+
.join()
88+
.unwrap();
89+
println!("fum");
90+
}
91+
```
92+
93+
Here's what running this test looks like before Rust 1.49.0:
94+
95+
```text
96+
❯ cargo test
97+
Compiling threadtest v0.1.0 (C:\threadtest)
98+
Finished test [unoptimized + debuginfo] target(s) in 0.38s
99+
Running target\debug\deps\threadtest-02f42ffd9836cae5.exe
100+
101+
running 1 test
102+
fie
103+
foe
104+
test thready_pass ... ok
105+
106+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
107+
108+
Doc-tests threadtest
109+
110+
running 0 tests
111+
112+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
113+
```
114+
115+
You can see that the output from the thread is printed, which intermixes
116+
from the output of the test framework itself. Wouldn't it be nice
117+
if every `println!` worked like that one that prints "`fum`?" Well, [that's
118+
the behavior in Rust 1.49.0](https://github.com/rust-lang/rust/pull/78227):
119+
120+
```text
121+
❯ cargo +nightly test
122+
Compiling threadtest v0.1.0 (C:\threadtest)
123+
Finished test [unoptimized + debuginfo] target(s) in 0.52s
124+
Running target\debug\deps\threadtest-40aabfaa345584be.exe
125+
126+
running 1 test
127+
test thready_pass ... ok
128+
129+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
130+
131+
Doc-tests threadtest
132+
133+
running 0 tests
134+
135+
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
136+
```
137+
138+
But don't worry; if the test were to fail, you'll still see all of the
139+
output. By adding a `panic!` to the end of the test, we can see what failure
140+
looks like:
141+
142+
```text
143+
❯ cargo +nightly test
144+
Compiling threadtest v0.1.0 (C:\threadtest)
145+
Finished test [unoptimized + debuginfo] target(s) in 0.52s
146+
Running target\debug\deps\threadtest-40aabfaa345584be.exe
147+
148+
running 1 test
149+
test thready_pass ... FAILED
150+
151+
failures:
152+
153+
---- thready_pass stdout ----
154+
fee
155+
fie
156+
foe
157+
fum
158+
thread 'thready_pass' panicked at 'explicit panic', src\lib.rs:11:5
159+
```
160+
161+
Specifically, the test runner makes sure to capture the output, and saves it
162+
in case the test fails.
163+
164+
### Library changes
165+
166+
In Rust 1.49.0, there are three new stable functions:
167+
168+
- [`slice::select_nth_unstable`]
169+
- [`slice::select_nth_unstable_by`]
170+
- [`slice::select_nth_unstable_by_key`]
171+
172+
And two functions were made `const`:
173+
174+
- [`Poll::is_ready`]
175+
- [`Poll::is_pending`]
176+
177+
See the [detailed release notes][notes] to learn about other changes.
178+
179+
[`slice::select_nth_unstable`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable
180+
[`slice::select_nth_unstable_by`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by
181+
[`slice::select_nth_unstable_by_key`]: https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.select_nth_unstable_by_key
182+
[`Poll::is_ready`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_ready
183+
[`Poll::is_pending`]: https://doc.rust-lang.org/stable/std/task/enum.Poll.html#method.is_pending
184+
185+
### Other changes
186+
187+
[relnotes-cargo]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-149-2020-12-31
188+
[relnotes-clippy]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-149
189+
190+
There are other changes in the Rust 1.49.0 release: check out what changed in
191+
[Rust][notes], [Cargo][relnotes-cargo], and [Clippy][relnotes-clippy].
192+
193+
## Contributors to 1.49.0
194+
195+
Many people came together to create Rust 1.49.0. We couldn't have done it
196+
without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.49.0/)

0 commit comments

Comments
 (0)