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.