Email me

Rust versions / 1.31

Rust release · Dec 6, 2018

Rust 1.31: what's new, what was stabilized

Short answerRust 1.31 was released on Dec 6, 2018: the Rust 2018 edition; 9 newly stable APIs (slice::align_to, slice::align_to_mut, slice::chunks_exact, slice::chunks_exact_mut, ...). Point release: 1.31.1 (Dec 20, 2018).

Dec 6, 2018release date
0language stabilizations
9APIs stabilized
2018new edition

← Rust 1.30All versionsRust 1.32 →

9 APIs stabilized

slice::align_to, slice::align_to_mut, slice::chunks_exact, slice::chunks_exact_mut, slice::rchunks, slice::rchunks_mut, slice::rchunks_exact, slice::rchunks_exact_mut, Option::replace

Can it break my build?

No compatibility notes were listed for this release.

Use it

rustup update stable        # get the newest release
rustup install 1.31          # or exactly this one
rustup override set 1.31     # pin a project to it

To require at least this version from users of your crate, set rust-version = "1.31" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.

Full release notes

Language

  • 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉
  • [New lifetime elision rules now allow for eliding lifetimes in functions and impl headers.][54778] E.g. impl<'a> Reader for BufReader<'a> {} can now be impl Reader for BufReader<'_> {}. Lifetimes are still required to be defined in structs.
  • [You can now define and use const functions.][54835] These are currently a strict minimal subset of the [const fn RFC][RFC-911]. Refer to the [language reference][const-reference] for what exactly is available.
  • [You can now use tool lints, which allow you to scope lints from external tools using attributes.][54870] E.g. #[allow(clippy::filter_map)].
  • [#[no_mangle] and #[export_name] attributes can now be located anywhere in a crate, not just in exported functions.][54451]
  • [You can now use parentheses in pattern matches.][54497]

Compiler

  • [Updated musl to 1.1.20][54430]

Libraries

  • [You can now convert num::NonZero* types to their raw equivalents using the From trait.][54240] E.g. u8 now implements From<NonZeroU8>.
  • [You can now convert a &Option<T> into Option<&T> and &mut Option<T> into Option<&mut T> using the From trait.][53218]
  • [You can now multiply (*) a time::Duration by a u32.][52813]

Stabilized APIs

  • [slice::align_to]
  • [slice::align_to_mut]
  • [slice::chunks_exact]
  • [slice::chunks_exact_mut]
  • [slice::rchunks]
  • [slice::rchunks_mut]
  • [slice::rchunks_exact]
  • [slice::rchunks_exact_mut]
  • [Option::replace]

Cargo

1.31.1 (Dec 20, 2018)

Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.

← Rust 1.30All versionsRust 1.32 →

Up next

Next releaseRust 1.32Released Jan 17, 2019.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ