-
Notifications
You must be signed in to change notification settings - Fork 301
Add 1.60.0 blog post #952
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
Add 1.60.0 blog post #952
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f15c6ee
Add blog post
Mark-Simulacrum 8f95d6b
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum 15933cf
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum 1248cfd
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum 01a16a6
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum f027b3d
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum 5f778be
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum af31313
Adjustments
Mark-Simulacrum 623ec6a
Update posts/2022-04-07-Rust-1.60.0.md
Mark-Simulacrum 5e7e07a
Add Instant monotonicity section
Mark-Simulacrum ffc8e26
Apply suggestions from code review
pietroalbini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
--- | ||
layout: post | ||
title: "Announcing Rust 1.60.0" | ||
author: The Rust Release Team | ||
release: true | ||
--- | ||
|
||
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. | ||
|
||
If you have a previous version of Rust installed via rustup, you can get 1.60.0 with: | ||
|
||
```console | ||
rustup update stable | ||
``` | ||
|
||
If you don't have it already, you can [get `rustup`][install] | ||
from the appropriate page on our website, and check out the | ||
[detailed release notes for 1.60.0][notes] on GitHub. | ||
If you'd like to help us out by testing future releases, you might consider updating locally to use | ||
the beta channel (`rustup default beta`) or the nightly channel (`rustup default nightly`). Please [report] any bugs you might come across! | ||
|
||
[install]: https://www.rust-lang.org/install.html | ||
[notes]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1600-2022-04-07 | ||
[report]: https://github.com/rust-lang/rust/issues/new/choose | ||
|
||
## What's in 1.60.0 stable | ||
|
||
### Instrumentation-based Code Coverage | ||
|
||
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`: | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```shell= | ||
RUSTFLAGS="-C instrument-coverage" cargo build | ||
``` | ||
|
||
After that, you can run the resulting binary, which will produce | ||
a `default.profraw` file in the current directory. That can be consumed | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
by the `llvm-cov` binary shipped with rustc as part of the llvm-tools-preview | ||
component. | ||
|
||
```shell= | ||
rustup component add llvm-tools-preview | ||
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse default.profraw -o default.profdata | ||
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov show -Xdemangler=rustfilt target/debug/coverage-testing \ | ||
-instr-profile=default.profdata \ | ||
-show-line-counts-or-regions \ | ||
-show-instantiations | ||
``` | ||
|
||
The above commands on a simple helloworld binary produce this annotated report, showing that each line of the input was covered. | ||
|
||
``` | ||
1| 1|fn main() { | ||
2| 1| println!("Hello, world!"); | ||
3| 1|} | ||
``` | ||
|
||
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. | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### `cargo --timings` | ||
|
||
Cargo has stabilized support for collecting information on build with the `--timings` flag. | ||
|
||
```shell | ||
$ cargo build --timings | ||
Compiling hello-world v0.1.0 (hello-world) | ||
Timing report saved to target/cargo-timings/cargo-timing-20220318T174818Z.html | ||
Finished dev [unoptimized + debuginfo] target(s) in 0.98s | ||
``` | ||
|
||
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. | ||
More information about the timing reports may be found in the [documentation](https://doc.rust-lang.org/nightly/cargo/reference/timings.html). | ||
|
||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### New syntax for Cargo features | ||
|
||
This release introduces two new changes to improve support for [Cargo features](https://doc.rust-lang.org/cargo/reference/features.html) and how they interact with [optional dependencies](https://doc.rust-lang.org/cargo/reference/features.html#optional-dependencies): Namespaced dependencies and weak dependency features. | ||
|
||
Cargo has long supported features along with optional dependencies, as illustrated by the snippet below. | ||
|
||
```toml | ||
[dependencies] | ||
jpeg-decoder = { version = "0.1.20", default-features = false, optional = true } | ||
|
||
[features] | ||
# Enables parallel processing support by enabling the "rayon" feature of jpeg-decoder. | ||
parallel = ["jpeg-decoder/rayon"] | ||
``` | ||
|
||
There are two things to note in this example. First, the optional dependency `jpeg-decoder` implicitly defines a feature of the same name, which provides a means to enable the dependency. Second, the `"jpeg-decoder/rayon"` syntax enables the `rayon` feature of the `jpeg-decoder` dependency, *and* also enables the `jpeg-decoder` dependency. | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Namespaced features tackles the first issue that optional dependencies are implicitly exposed as part of a package's public interface. You can now use the `dep:` prefix in the `[features]` table to explicitly refer to an optional dependency. This gives you more control to define the feature corresponding to the optional dependency, and to hide optional dependencies behind more descriptive feature names. | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Weak dependency features tackles the second issue where the `"package-name/feature-name"` syntax would 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. | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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: | ||
|
||
```toml | ||
[dependencies] | ||
serde = { version = "1.0.133", optional = true } | ||
rgb = { version = "0.8.25", optional = true } | ||
|
||
[features] | ||
serde = ["dep:serde", "rgb?/serde"] | ||
``` | ||
|
||
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. | ||
|
||
### Incremental compilation status | ||
|
||
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. | ||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Stabilized APIs | ||
|
||
The following methods and trait implementations are now stabilized: | ||
|
||
- [`Arc::new_cyclic`][arc_new_cyclic] | ||
- [`Rc::new_cyclic`][rc_new_cyclic] | ||
- [`slice::EscapeAscii`][slice_escape_ascii] | ||
- [`<[u8]>::escape_ascii`][slice_u8_escape_ascii] | ||
- [`u8::escape_ascii`][u8_escape_ascii] | ||
- [`Vec::spare_capacity_mut`][vec_spare_capacity_mut] | ||
- [`MaybeUninit::assume_init_drop`][assume_init_drop] | ||
- [`MaybeUninit::assume_init_read`][assume_init_read] | ||
- [`i8::abs_diff`][i8_abs_diff] | ||
- [`i16::abs_diff`][i16_abs_diff] | ||
- [`i32::abs_diff`][i32_abs_diff] | ||
- [`i64::abs_diff`][i64_abs_diff] | ||
- [`i128::abs_diff`][i128_abs_diff] | ||
- [`isize::abs_diff`][isize_abs_diff] | ||
- [`u8::abs_diff`][u8_abs_diff] | ||
- [`u16::abs_diff`][u16_abs_diff] | ||
- [`u32::abs_diff`][u32_abs_diff] | ||
- [`u64::abs_diff`][u64_abs_diff] | ||
- [`u128::abs_diff`][u128_abs_diff] | ||
- [`usize::abs_diff`][usize_abs_diff] | ||
- [`Display for io::ErrorKind`][display_error_kind] | ||
- [`From<u8> for ExitCode`][from_u8_exit_code] | ||
- [`Not for !` (the "never" type)][not_never] | ||
- [_Op_`Assign<$t> for Wrapping<$t>`][wrapping_assign_ops] | ||
- [`arch::is_aarch64_feature_detected!`][is_aarch64_feature_detected] | ||
|
||
### Other changes | ||
|
||
There are other changes in the Rust 1.60.0 release. Check out what changed in | ||
[Rust](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1600-2022-04-07), | ||
[Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-160-2022-04-07), | ||
and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-160). | ||
|
||
### Contributors to 1.60.0 | ||
|
||
Many people came together to create Rust 1.60.0. | ||
We couldn't have done it without all of you. | ||
[Thanks!](https://thanks.rust-lang.org/rust/1.60.0/) | ||
|
||
[arc_new_cyclic]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_cyclic | ||
[rc_new_cyclic]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_cyclic | ||
[slice_escape_ascii]: https://doc.rust-lang.org/stable/std/slice/struct.EscapeAscii.html | ||
[slice_u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.slice.html#method.escape_ascii | ||
[u8_escape_ascii]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.escape_ascii | ||
[vec_spare_capacity_mut]: https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.spare_capacity_mut | ||
[assume_init_drop]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_drop | ||
[assume_init_read]: https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#method.assume_init_read | ||
[i8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i8.html#method.abs_diff | ||
[i16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i16.html#method.abs_diff | ||
[i32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i32.html#method.abs_diff | ||
[i64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i64.html#method.abs_diff | ||
[i128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.i128.html#method.abs_diff | ||
[isize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.isize.html#method.abs_diff | ||
[u8_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u8.html#method.abs_diff | ||
[u16_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u16.html#method.abs_diff | ||
[u32_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u32.html#method.abs_diff | ||
[u64_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u64.html#method.abs_diff | ||
[u128_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.u128.html#method.abs_diff | ||
[usize_abs_diff]: https://doc.rust-lang.org/stable/std/primitive.usize.html#method.abs_diff | ||
[display_error_kind]: https://doc.rust-lang.org/stable/std/io/enum.ErrorKind.html#impl-Display | ||
[from_u8_exit_code]: https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html#impl-From%3Cu8%3E | ||
[not_never]: https://doc.rust-lang.org/stable/std/primitive.never.html#impl-Not | ||
[wrapping_assign_ops]: https://doc.rust-lang.org/stable/std/num/struct.Wrapping.html#trait-implementations | ||
[is_aarch64_feature_detected]: https://doc.rust-lang.org/stable/std/arch/macro.is_aarch64_feature_detected.html |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.