News for the Rustaceans

Rust 1.42.0 adds subslice patterns and improved panic messaging

Sarah Schlothauer
© Shutterstock / Muanpare Wanpen

The Rust dev team has been hard at work. Less than three months after the previous release, Rust version 1.42.0 stable is here. This update introduces some new features such as subslice patterns, and better panic messages when unwrapping. Rustaceans, come and see what the newest highlights are.

The newest version of Rust is now generally available. Version 1.42.0 stable arrived on March 12, 2020,

As usual with all new Rust releases, you can easily update to the latest version via rustup with:

$ rustup update stable

This release arrives less than three months after the previous release. Rust is always on the move with new features, changes, and improvements so let’s keep up with the pace and see what’s new. According to, there were 302 merged pull requests during the week of March 10, 2020.

Here are some of the highlights:

SEE ALSO: 90% of remote workers would recommend it to a friend

Improved error messaging

Previously, when calling unwrap() on an Option::None value, Rust produced an error message that wasn’t always helpful and didn’t provide enough location information.

Now, the panic message is a little more developer-friendly and shows which line the invalid call to unwrap is located.

Before (1.41.0)

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /.../src/libcore/macros/

After (1.42.0)

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/

The new message shows that the error is on line 2 of src/ View and track the original discussion of this on GitHub.

Introducing subslice patterns

Slice patterns allow users to match on slices. Now, 1.42 adds support for matching on parts of a slice.

From a blog post by Mazdak “Centril” Farrokhzad:

In Rust 1.42.0, we are stabilizing subslice patterns. To introduce a subslice pattern, we use .. which denotes a variable-length gap, matching as many elements as possible not matched by the patterns before and after the ...

We can also bind a subslice to a variable. For example, suppose we want to disallow ... in all but the last parameter of a function.

According to Farrokhzad’s blog post, stable subslice patterns are more than 7 years in the making!

Deprecations and downgrades

The Error::description method is now deprecated. It has been “soft deprecated” since Rust 1.27 when it was de-emphasized in the official documentation. Now, it is officially deprecated, although due to Rust’s stability policy, it will not be officially removed. See the pull request for more information.

Since Apple no longer supports 32-bit targets, Rust has officially downgraded them to Tier 3 support in 1.42.0. Tier 3 support means that they will not be available for download using rustup and will be ignored during automatic builds. From now on, users will have to build from the source and may encounter errors and bugs.

SEE ALSO: PHP is very much alive and doesn’t plan on dying

Misc. Rust 1.42.0 changes

Additional changes include:

Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is the editor for She received her Bachelor's degree from Monmouth University, West Long Branch, New Jersey. She currently lives in Frankfurt, Germany with her husband and cat where she enjoys reading, writing, and medieval reenactment. She is also the editor for Conditio Humana, an online magazine about ethics, AI, and technology.

Inline Feedbacks
View all comments