Skip to content

Rust 1.42.0

Compare
Choose a tag to compare
@pietroalbini pietroalbini released this 07 Sep 16:49
· 20445 commits to master since this release

Language

  • You can now use the slice pattern syntax with subslices. e.g.

    fn foo(words: &[&str]) {
        match words {
            ["Hello", "World", "!", ..] => println!("Hello World!"),
            ["Foo", "Bar", ..] => println!("Baz"),
            rest => println!("{:?}", rest),
        }
    }
  • You can now use #[repr(transparent)] on univariant enums. Meaning that you can create an enum that has the exact layout and ABI of the type it contains.

  • There are some syntax-only changes:

    • default is syntactically allowed before items in trait definitions.
    • Items in impls (i.e. consts, types, and fns) may syntactically leave out their bodies in favor of ;.
    • Bounds on associated types in impls are now syntactically allowed (e.g. type Foo: Ord;).
    • ... (the C-variadic type) may occur syntactically directly as the type of any function parameter.

    These are still rejected semantically, so you will likely receive an error but these changes can be seen and parsed by procedural macros and conditional compilation.

Compiler

* Refer to Rust's platform support page for more information on Rust's tiered platform support.

Libraries

Stabilized APIs

Cargo

Compatibility Notes