Categories: NewsRust

Rust 1.42.0 Released with Improved error messaging

Rust Team has recently announced the release of Rust 1.4.2.0!

Rust is an open-source programming language that pays attention to speed, memory safety, parallelism, and, empowers everyone to build reliable and efficient software.

What’s New in Rust 1.42.0

  • Subslice patterns
  • Improved panic Messages
  • Slice pattern syntax with subslices.
  • Improved error messaging
  • New macro

Depreciation in Rust 1.42.0

Error::description has been deprecated, and its use will now produce a warning. It’s recommended to use Display/to_string instead.

Slice pattern syntax with subslices.

Subslice/subarray patterns come in two flavors syntactically. In Rust 1.42, the support has been expanded for matching on parts of a slice:

fn foo(words: &[&str]) {
    match words {
        ["Hello", "World", "!", ..] => println!("Hello World!"),
        ["Foo", "Bar", ..] => println!("Baz"),
        rest => println!("{:?}", rest),
    }
}

Improved panic Messages

In Rust 1.42.0, all eight functions produce panic messages that provide the line number where they were invoked.

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

New macro

The new matches! macro accepts an expression and a pattern. If the pattern matches the expression, it returns true.

Updating the Rust to 1.42.0

To update the Rust to latest version Run the following command in your Terminal

rustup update stable

Other Changes in Rust 1.42.0

You can view the detailed Changes in Rust 1.42.0 Here.

Deven Rathore

Deven is an Entrepreneur, and Full-stack developer, Constantly learning and experiencing new things. He currently runs CodeSource.io and Dunebook.com.

Published by
Deven Rathore
Tags: Rust 1.42.0

Recent Posts

The Best 5 Career Advice for Web Design Students

Are you thinking of a career in web design but not sure where to start? The…

1 day ago

Top 10 Flutter eCommerce UI Kits and Apps with source code

In this article, We will be looking at some of the best open-source Flutter eCommerce…

2 days ago

Top 10 best Opensource Jekyll themes

In this article, We will be looking at some of the top Jekyll themes. Jekyll…

3 weeks ago

5 Easy Tips on How to Cite Sources in a Technical Article

Citing is the act of acknowledging and giving credit to the original creator of the…

3 weeks ago

Features and Advantages for PostgreSQL Developers

Data can be complicated and hard to manage. However, it doesn't need to be. There…

2 weeks ago

How To Find The Top 3 Fleet Management Software Freeware

Industry experts agree on one thing - fleet management innovation is vital for optimizing business…

4 weeks ago