Latest in branch 1.73
1.73.0
Released 05 Oct 2023
(2 years ago)
SoftwareRust
Version1.73
Initial release1.73.0
05 Oct 2023
(2 years ago)
Latest release1.73.0
05 Oct 2023
(2 years ago)
Support status17 Nov 2023
(Ended 2 years ago)
Release noteshttps://github.com/rust-lang/rust/releases/tag/1.73.0
Source codehttps://github.com/rust-lang/rust/tree/1.73.0
Downloadhttps://github.com/rust-lang/rust/releases/tag/1.73.0
Rust 1.73 ReleasesView full list

What Is New in Rust 1.73

CategoryHighlights
New FeaturesThread-local `LocalKey` now has get/set/take/replace methods; several APIs stabilized for const use.
ImprovementsPanic messages are formatted without surrounding quotes and `assert_eq`/`assert_ne` output is cleaner.

How have panic messages changed in Rust 1.73?

Panic output no longer wraps the message in quotes and places the message on its own line.

This matters if your logs contain long or multi-line panic strings, because the new layout is easier to scan.

fn main() {
    let file = "ferris.txt";
    panic!("oh no! {file:?} not found!");
}

Running the program now prints:

thread 'main' panicked at src/main.rs:3:5:
oh no! "ferris.txt" not found!

What new thread-local APIs does Rust 1.73 provide?

The `LocalKey` type now exposes `get`, `set`, `take`, and `replace` methods directly.

This reduces boilerplate and avoids the extra initialization that the old `with` closure performed.

thread_local! {
    static THINGS: std::cell::Cell> = std::cell::Cell::new(Vec::new());
}

fn demo() {
    // old style
    THINGS.with(|c| c.set(vec![1, 2, 3]));
    // new style
    THINGS.set(vec![1, 2, 3]);

    // old style
    let v = THINGS.with(|c| c.take());
    // new style
    let v: Vec = THINGS.take();
}

Which APIs are now usable in const contexts as of Rust 1.73?

A handful of standard library functions have been stabilized for const evaluation.

This matters for embedded and compile-time computation because you can now call these functions inside `const fn` or const blocks.

Typical usage looks like:

const fn compute() -> usize {
    // call to a newly const-stabilized API
    std::mem::size_of::<[u8; 32]>()
}

Frequently Asked Questions

Does upgrading to Rust 1.73 require changes to existing code?
Most code will compile unchanged; only the visual format of panic messages differs.

How can I see the new panic format in my own program?
Run a program that calls panic! or assert_eq! and observe that the message appears on a separate line after the location.

What is the syntax to set a thread-local value with the new API?
Use THINGS.set(vec![1, 2, 3]); instead of the older THINGS.with(|v| v.set(...));

Are there any breaking changes associated with the new const APIs?
No breaking changes; the const support is additive.

How do I upgrade my toolchain to Rust 1.73?
Run rustup update stable.

Can I use the new LocalKey methods in a no_std environment?
Yes, the methods are part of core and work without the standard library.

Releases In Branch 1.73

VersionRelease date
1.73.005 Oct 2023
(2 years ago)