From 1d02ae98b16d52d076a9b3bdb91c2f05ec8d6185 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Mon, 20 Jun 2022 19:16:32 -0700 Subject: [PATCH 1/4] Rust 1.62.0 --- posts/2022-06-30-Rust-1.62.0.md | 122 ++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 posts/2022-06-30-Rust-1.62.0.md diff --git a/posts/2022-06-30-Rust-1.62.0.md b/posts/2022-06-30-Rust-1.62.0.md new file mode 100644 index 000000000..dce11c1cb --- /dev/null +++ b/posts/2022-06-30-Rust-1.62.0.md @@ -0,0 +1,122 @@ +# Rust 1.62.0 + +--- +layout: post +title: "Announcing Rust 1.62.0" +author: The Rust Release Team +release: true +--- + +The Rust team is happy to announce a new version of Rust, 1.62.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.62.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.62.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-1620-2022-06-30 +[report]: https://github.com/rust-lang/rust/issues/new/choose + +## What's in 1.62.0 stable + +### `cargo add` + +You can now add new dependencies directly from the command line using `cargo add`. This command supports specifying features and versions. It can also be used to modify existing dependencies. + +For example: + +```console +cargo add log +cargo add serde --features derive +cargo add nom@5 +``` + +See the [cargo documentation](https://doc.rust-lang.org/nightly/cargo/commands/cargo-add.html) for more. + +### `#[default]` enum variants + +You can now use `#[derive(Default)]` on enums if you specify a default variant. For example, until now you would have to manually write a `Default` impl for this enum: + + +```rust +#[derive(Default)] +enum Maybe { + #[default] + Nothing, + + Something(T), +} +``` + +As of now only "unit" variants (variants that have no fields) are allowed to be marked `#[default]`. More information is available in the [RFC](https://rust-lang.github.io/rfcs/3107-derive-default-enum.html) for this feature. + +### Thinner, faster mutexes on Linux + +Previously, `Mutex`, `Condvar`, and `RwLock` were backed by the pthreads library on Linux. The pthreads locks support more features than the Rust APIs themselves do, including runtime configuration, and are designed to be used in languages with fewer static guarantees than Rust provides. + +The mutex implementation, for example, is 40 bytes and cannot be moved. This forced us the standard library to allocate a `Box` behind the scenes for each new mutex for platforms that use pthreads. + +Rust's standard library now ships with a raw futex-based implementation of these locks on Linux, which is very lightweight and doesn't require extra allocation. In 1.62.0 `Mutex` only needs 5 bytes for its internal state on Linux, though this may change in future versions. + +This is part of a long effort to improve the efficiency of Rust's lock types, which includes previous improvements on Windows such as unboxing its primitives. You can read more about that effort in the [tracking issue](https://github.com/rust-lang/rust/issues/93740). + +### Bare metal `x86_64` target + +It's now easier to build OS-less binaries for `x86_64`, for example when writing a kernel. `x86_64-unknown-none` has been promoted to a Tier 2 target and can be installed with rustup. + +```console +rustup target add x86_64-unknown-none +rustc --target x86_64-unknown-none my_no_std_program.rs +``` + +You can read more about development using `no_std` in the [Embedded Rust book](https://docs.rust-embedded.org/book/intro/no-std.html). + +### Stabilized APIs + +The following methods and trait implementations are now stabilized: + +- [`bool::then_some`] +- [`f32::total_cmp`] +- [`f64::total_cmp`] +- [`Stdin::lines`] +- [`windows::CommandExt::raw_arg`] +- [`impl Default for AssertUnwindSafe`] +- [`From> for Rc<[u8]>`][rc-u8-from-str] +- [`From> for Arc<[u8]>`][arc-u8-from-str] +- [`FusedIterator for EncodeWide`] +- [RDM intrinsics on aarch64][stdarch/1285] + +### Other changes + +There are other changes in the Rust 1.62.0 release. Check out what changed in +[Rust](https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1620-2022-06-30), +[Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-1620-2022-06-30), +and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-162). + +### Contributors to 1.62.0 + +Many people came together to create Rust 1.62.0. +We couldn't have done it without all of you. +[Thanks!](https://thanks.rust-lang.org/rust/1.62.0/) + +[`bool::then_some`]: https://doc.rust-lang.org/stable/std/primitive.bool.html#method.then_some +[`f32::total_cmp`]: https://doc.rust-lang.org/stable/std/primitive.f32.html#method.total_cmp +[`f64::total_cmp`]: https://doc.rust-lang.org/stable/std/primitive.f64.html#method.total_cmp +[`Stdin::lines`]: https://doc.rust-lang.org/stable/std/io/struct.Stdin.html#method.lines +[`impl Default for AssertUnwindSafe`]: https://doc.rust-lang.org/stable/std/panic/struct.AssertUnwindSafe.html#impl-Default +[rc-u8-from-str]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#impl-From%3CRc%3Cstr%3E%3E +[arc-u8-from-str]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#impl-From%3CArc%3Cstr%3E%3E +[stdarch/1285]: https://github.com/rust-lang/stdarch/pull/1285 +[`windows::CommandExt::raw_arg`]: https://doc.rust-lang.org/stable/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg +[`FusedIterator for EncodeWide`]: https://doc.rust-lang.org/stable/std/os/windows/ffi/struct.EncodeWide.html#impl-FusedIterator From 448d8679545d846733c48124474f04efefb8cb2d Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 20 Jun 2022 23:43:58 -0700 Subject: [PATCH 2/4] Apply suggestion to fix grammar Co-authored-by: Caleb Cartwright --- posts/2022-06-30-Rust-1.62.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts/2022-06-30-Rust-1.62.0.md b/posts/2022-06-30-Rust-1.62.0.md index dce11c1cb..b599d5de1 100644 --- a/posts/2022-06-30-Rust-1.62.0.md +++ b/posts/2022-06-30-Rust-1.62.0.md @@ -65,7 +65,7 @@ As of now only "unit" variants (variants that have no fields) are allowed to be Previously, `Mutex`, `Condvar`, and `RwLock` were backed by the pthreads library on Linux. The pthreads locks support more features than the Rust APIs themselves do, including runtime configuration, and are designed to be used in languages with fewer static guarantees than Rust provides. -The mutex implementation, for example, is 40 bytes and cannot be moved. This forced us the standard library to allocate a `Box` behind the scenes for each new mutex for platforms that use pthreads. +The mutex implementation, for example, is 40 bytes and cannot be moved. This forced the standard library to allocate a `Box` behind the scenes for each new mutex for platforms that use pthreads. Rust's standard library now ships with a raw futex-based implementation of these locks on Linux, which is very lightweight and doesn't require extra allocation. In 1.62.0 `Mutex` only needs 5 bytes for its internal state on Linux, though this may change in future versions. From 0200b7b2dfb4bafd77f0d83a7a1cfe848641d5ec Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Tue, 21 Jun 2022 14:01:58 -0700 Subject: [PATCH 3/4] Respond to comments --- posts/2022-06-30-Rust-1.62.0.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/posts/2022-06-30-Rust-1.62.0.md b/posts/2022-06-30-Rust-1.62.0.md index b599d5de1..f461d0de9 100644 --- a/posts/2022-06-30-Rust-1.62.0.md +++ b/posts/2022-06-30-Rust-1.62.0.md @@ -1,5 +1,3 @@ -# Rust 1.62.0 - --- layout: post title: "Announcing Rust 1.62.0" @@ -73,7 +71,7 @@ This is part of a long effort to improve the efficiency of Rust's lock types, wh ### Bare metal `x86_64` target -It's now easier to build OS-less binaries for `x86_64`, for example when writing a kernel. `x86_64-unknown-none` has been promoted to a Tier 2 target and can be installed with rustup. +It's now easier to build OS-less binaries for `x86_64`, for example when writing a kernel. The [`x86_64-unknown-none` target](https://doc.rust-lang.org/beta/rustc/platform-support/x86_64-unknown-none.html) has been promoted to [Tier 2](https://doc.rust-lang.org/rustc/platform-support.html#tier-2) and can be installed with rustup. ```console rustup target add x86_64-unknown-none From 452900fcdd233c137a94578554f04fa8988e10e6 Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Fri, 24 Jun 2022 17:28:22 -0700 Subject: [PATCH 4/4] Update posts/2022-06-30-Rust-1.62.0.md Co-authored-by: Eric Huss --- posts/2022-06-30-Rust-1.62.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posts/2022-06-30-Rust-1.62.0.md b/posts/2022-06-30-Rust-1.62.0.md index f461d0de9..c5634820f 100644 --- a/posts/2022-06-30-Rust-1.62.0.md +++ b/posts/2022-06-30-Rust-1.62.0.md @@ -99,7 +99,7 @@ The following methods and trait implementations are now stabilized: There are other changes in the Rust 1.62.0 release. Check out what changed in [Rust](https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1620-2022-06-30), -[Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-1620-2022-06-30), +[Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-162-2022-06-30), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-162). ### Contributors to 1.62.0