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

Web and App Frameworks Most Susceptible to Hacking

Hackers target web and app frameworks to try and exploit inbuilt weaknesses. Over the years,…

2 days ago

15 Javascript compression tools

In short, JavaScript code compression has to do with the removal of every unnecessary character…

4 days ago

Free Applications and Websites to Enhance Coding Skills

Obtaining any skill means that one will continuously upgrade it to become professional. It’s impossible…

4 weeks ago

How to Use Disk Drill Partition Recovery Software for Mac

With the keyboard shortcut "Command(⌘) + Option(⌥) + Delete(⌫)" you can completely remove a file…

4 weeks ago

21 React Project Ideas for Beginners

For some weeks now, you have been putting in a lot of effort in understanding…

1 month ago

Reasons for Creating a Custom Transportation Management Software

Transportation management software is used by organizations to administer, control, and manage the transportation aspect…

1 month ago