Rust 1.88 Adds Naked Function Support
Written by Kay Ewbank   
Monday, 30 June 2025

Rust 1.88 has been released with support for naked functions and for Let chains. In addtion, from now on, Cargo will automatically run garbage collection on the cache in its home directory.

Rust is popular for situations including being embedded in other languages, writing programs with specific space and time requirements, and writing low-level code.

rust foundation logo

The new support for naked functions means developers writing in Rust can now write functions with no compiler-generated epilogue and prologue. The advantage this provides is that it allows full control over the generated assembly for a particular function. The team says this is a more ergonomic alternative to defining functions in a global_asm! block. A naked function is marked with the #[unsafe(naked)] attribute, and its body consists of a single naked_asm! call.

Let chain support has also been added to this release. Let chains allow &&-chaining let statements inside if and while conditions, even intermingling with boolean expressions. This means there is less distinction between if/if let and while/while let. The patterns inside the let sub-expressions can be irrefutable or refutable, and bindings are usable in later parts of the chain as well as the body.

Let chains are only available in the Rust 2024 edition, as this feature depends on the if let temporary scope change for more consistent drop order. The developers say that they did their best to find a version that worked with earlier editions of Rust, but it wasn't possible. If you want to use this, you'll need to upgrade your crate's edition. 

Another improvement adds support for boolean literals to the cfg predicate language. The literals true and false act as a configuration that is always enabled or disabled, respectively. This works in Rust conditional compilation with cfg and cfg_attr attributes and the built-in cfg! macro. 

While it was possible to achieve the same results as this provides in earlier releases using empty predicate lists, the developers say using cfg(true) and cfg(false) offer a more direct way to say what you mean.

The other main improvement in this release is that from now on Cargo will automatically run garbage collection on the cache in its home directory. When building, Cargo downloads and caches crates needed as dependencies. Historically, these downloaded files would never be cleaned up, leading to an unbounded amount of disk usage in Cargo's home directory. The new garbage collection mechanism will automatically clean up old files (e.g. .crate files) after a set amount of time when they've not been accessed. 

Version 1.88 of Rust is available now.

rust foundation logo

More Information

Rust Foundation Website

Related Articles

Rust Celebrates 10 Years Since Version 1.0

Rust 1.84 Adds Strict Provenance APIs

Rust 1.83 Improves Const Context Code Handling

Rust 1.82 Improves Apple Support

Is Rust Safe?

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Chinese Robots Play Three-a-Side Soccer
06/07/2025

Four teams of humanoid robots faced off in fully autonomous 3-on-3 soccer matches in the latest event organized to showcase China’s advances in humanoid robot technology. It was the first such compe [ ... ]



Mozilla Discontinues DeepSpeech
03/07/2025

The DeepSpeech project started by Mozilla has updated its GitHub page with the message "This project is now discontinued", and a change in the project status to archived. 


More News

pico book

 

Comments




or email your comment to: comments@i-programmer.info