Paul Krill
Editor at Large

Rust stabilizes inline const expressions

news
Jun 14, 20242 mins

Associated item bounds syntax also is stabilized in the Rust 1.79 release.

chain rust link heavy iron metal
Credit: cortixxx

The Rust Team has released Rust 1.79, an update to the memory safe programming language that stabilizes both inline const expressions and the associated item bounds syntax.

Unveiled June 13, Rust 1.79 can be installed by running rustup update stable.

With Rust 1.79, const { … } blocks now are stable in the expression position, thus permitting explicitly entering a const context without needing extra declarations. Unlike const items, inline consts can make use of in-scope generics and have their type inferred rather than explicitly written, making them particularly useful for inline code snippets. This improvement makes code more succinct and easier to read, the Rust Team said.

Rust 1.79 also stabilizes the associated item bounds syntax, allowing for bounds to be put in associated type position within other bounds. This avoids a need to provide an extra, explicit generic type to constrain the associated type. The feature allows specifying bounds in a few places that previously were not possible or imposed unnecessary constraints on usage.

In another highlight of the Rust 1.79 release, the standard library distributed by the Rust project now is compiled with -Cforce-frame-pointers=yes, thus enabling downstream users to more easily profile their programs. Also in Rust 1.79, temporaries that are immediately referenced in construction now are automatically lifetime extended in match and if constructs. This offers the same behavior as lifetime extension for block constructs.

Rust 1.79 follows the May release of Rust 1.78, which emphasized diagnostic computes for compiler messages. Billed as fast and memory-efficient, Rust recently placed 10th in the June 2024 edition of the Pypl Popularity of Programming Language index.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author