Skip to content

Commit f15c6ee

Browse files
Add blog post
1 parent 62d8bad commit f15c6ee

File tree

2 files changed

+10288
-0
lines changed

2 files changed

+10288
-0
lines changed

posts/2022-04-07-Rust-1.60.0.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.60.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.60.0. Rust is a programming language empowering everyone to build reliable and efficient software.
9+
10+
If you have a previous version of Rust installed via rustup, you can get 1.60.0 with:
11+
12+
```console
13+
rustup update stable
14+
```
15+
16+
If you don't have it already, you can [get `rustup`][install]
17+
from the appropriate page on our website, and check out the
18+
[detailed release notes for 1.60.0][notes] on GitHub.
19+
If you'd like to help us out by testing future releases, you might consider updating locally to use
20+
the beta channel (`rustup default beta`) or the nightly channel (`rustup default nightly`). Please [report] any bugs you might come across!
21+
22+
[install]: https://www.rust-lang.org/install.html
23+
[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1600-2022-04-07
24+
[report]: https://github.com/rust-lang/rust/issues/new/choose
25+
26+
## What's in 1.60.0 stable
27+
28+
### Instrumentation-based Code Coverage
29+
30+
Support for LLVM-based coverage instrumentation has been stabilized in rustc, enabled with `-C instrument-coverage`. You can try this out on your code by rebuilding your code with `-Cinstrument-coverage`:
31+
32+
```shell=
33+
RUSTFLAGS="-C instrument-coverage" cargo build
34+
```
35+
36+
After that, you can run the resulting binary, which will produce
37+
a `default.profraw` file in the current directory. That can be consumed
38+
by the `llvm-cov` binary shipped with rustc as part of the llvm-tools-preview
39+
component.
40+
41+
```shell=
42+
rustup component add llvm-tools-preview
43+
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse default.profraw -o default.profdata
44+
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov show -Xdemangler=rustfilt target/debug/coverage-testing \
45+
-instr-profile=default.profdata \
46+
-show-line-counts-or-regions \
47+
-show-instantiations
48+
```
49+
50+
The above commands on a simple helloworld binary produce this annotated report, showing that each line of the input was covered.
51+
52+
```
53+
1| 1|fn main() {
54+
2| 1| println!("Hello, world!");
55+
3| 1|}
56+
```
57+
58+
For more details, please read the [documentation](https://doc.rust-lang.org/rustc/instrument-coverage.html) in the rustc book. The specific output format and LLVM tooling to consume it are both not guaranteed to exist in this specific form, but the baseline functionality will continue to exist for future Rust releases.
59+
60+
### `cargo --timings`
61+
62+
Cargo has stabilized support for collecting information on build with the `--timings` flag.
63+
64+
```shell
65+
$ cargo build --timings
66+
Compiling hello-world v0.1.0 (hello-world)
67+
Timing report saved to target/cargo-timings/cargo-timing-20220318T174818Z.html
68+
Finished dev [unoptimized + debuginfo] target(s) in 0.98s
69+
```
70+
71+
The report is also copied to `target/cargo-timings/cargo-timing.html`. A report on the release build of Cargo has been put up [here](/images/2022-04-07-timing.html). These reports can be useful for improving build performance.
72+
73+
### Weak feature dependencies in Cargo
74+
75+
Cargo has long supported [features](https://doc.rust-lang.org/cargo/reference/resolver.html#features) along with optional dependencies, as illustrated by the snippet below.
76+
77+
```toml
78+
[dependencies]
79+
jpeg-decoder = { version = "0.1.20", default-features = false, optional = true }
80+
81+
[features]
82+
# Enables parallel processing support by enabling the "rayon" feature of jpeg-decoder.
83+
parallel = ["jpeg-decoder/rayon"]
84+
```
85+
86+
The `"package-name/feature-name"` syntax will also enable package-name if it is an optional dependency. Often this is not what you want, and starting in 1.60, you can add a ? as in `"package-name?/feature-name"` which will only enable the given feature if something else enables the optional dependency.
87+
88+
For example, let's say we have added some serialization support to our library, and it requires enabling a corresponding feature in some optional dependencies. That can be done like this:
89+
90+
```toml
91+
[dependencies]
92+
serde = { version = "1.0.133", optional = true }
93+
rgb = { version = "0.8.25", optional = true }
94+
95+
[features]
96+
serde = ["dep:serde", "rgb?/serde"]
97+
```
98+
99+
In this example, enabling the serde feature will enable the serde dependency. It will also enable the serde feature for the rgb dependency, but only if something else has enabled the rgb dependency.
100+
101+
### Incremental compilation status
102+
103+
Incremental compilation is re-enabled for the 1.60 release. The Rust team continues to work on fixing bugs in incremental, but no problems causing widespread breakage are known at this time, so we have chosen to reenable incremental compilation. Additionally, the compiler team is continuing to work on long-term strategy to avoid future problems of this kind. That process is in relatively early days, so we don't have anything to share yet on that front.
104+
105+
### Stabilized APIs
106+
107+
The following methods and trait implementations are now stabilized:
108+
109+
- [`Arc::new_cyclic`][arc_new_cyclic]
110+
- [`Rc::new_cyclic`][rc_new_cyclic]
111+
- [`slice::EscapeAscii`][slice_escape_ascii]
112+
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii]
113+
- [`u8::escape_ascii`][u8_escape_ascii]
114+
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut]
115+
- [`MaybeUninit::assume_init_drop`][assume_init_drop]
116+
- [`MaybeUninit::assume_init_read`][assume_init_read]
117+
- [`i8::abs_diff`][i8_abs_diff]
118+
- [`i16::abs_diff`][i16_abs_diff]
119+
- [`i32::abs_diff`][i32_abs_diff]
120+
- [`i64::abs_diff`][i64_abs_diff]
121+
- [`i128::abs_diff`][i128_abs_diff]
122+
- [`isize::abs_diff`][isize_abs_diff]
123+
- [`u8::abs_diff`][u8_abs_diff]
124+
- [`u16::abs_diff`][u16_abs_diff]
125+
- [`u32::abs_diff`][u32_abs_diff]
126+
- [`u64::abs_diff`][u64_abs_diff]
127+
- [`u128::abs_diff`][u128_abs_diff]
128+
- [`usize::abs_diff`][usize_abs_diff]
129+
- [`Display for io::ErrorKind`][display_error_kind]
130+
- [`From<u8> for ExitCode`][from_u8_exit_code]
131+
- [`Not for !` (the "never" type)][not_never]
132+
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops]
133+
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected]
134+
135+
### Other changes
136+
137+
There are other changes in the Rust 1.60.0 release. Check out what changed in
138+
[Rust](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1600-2022-04-07),
139+
[Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-160-2022-04-07),
140+
and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-160).
141+
142+
### Contributors to 1.60.0
143+
144+
Many people came together to create Rust 1.60.0.
145+
We couldn't have done it without all of you.
146+
[Thanks!](https://thanks.rust-lang.org/rust/1.60.0/)
147+
148+
[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic
149+
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic
150+
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html
151+
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii
152+
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii
153+
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut
154+
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop
155+
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read
156+
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff
157+
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff
158+
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff
159+
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff
160+
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff
161+
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff
162+
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff
163+
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff
164+
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff
165+
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff
166+
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff
167+
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff
168+
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display
169+
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E
170+
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not
171+
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations
172+
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html

0 commit comments

Comments
 (0)