Rust 1.33.0 released with improvements to Const fn, pinning, and more!

0
1566
2 min read

Yesterday, the team at Rust announced the stable release, Rust 1.33.0, a programming language that helps in building reliable and efficient software. This release comes with significant improvements to const fns, and the stabilization of a new concept: “pinning.”

What’s new in Rust 1.33.0?

Const fn

It’s now possible to work with irrefutable destructuring patterns (e.g. const fn foo((x, y): (u8, u8)) { … }). This release also offers let bindings (e.g. let x = 1;). It also comes with mutable let bindings (e.g. let mut x = 1;)

Pinning

This release comes with a new concept for Rust programs called pinning. Pinning ensures that the pointee of any pointer type for example P has a stable location in memory. This means that it cannot be moved elsewhere and its memory cannot be deallocated until it gets dropped. And the pointee is said to be “pinned”.


Compiler

It is now possible to set a linker flavor for rustc with the -Clinker-flavor command line argument. The minimum required LLVM version is 6.0. This release comes with added support for the PowerPC64 architecture on FreeBSD and x86_64-unknown-uefi target.

Libraries

In this release, the methods overflowing_{add, sub, mul, shl, shr} are const functions for all numeric types. Now the is_positive and is_negative methods are const functions for all signed numeric types. Even the get method for all NonZero types is now const.

Language

It now possible to use the cfg(target_vendor) attribute. E.g. #[cfg(target_vendor=”apple”)] fn main() { println!(“Hello Apple!”); }. It is now possible to have irrefutable if let and while let patterns. It is now possible to specify multiple attributes in a cfg_attr attribute.

One of the users commented on the HackerNews, “This release also enables Windows binaries to run in Windows nanoserver containers.” Another comment reads, “It is nice to see the const fn improvements!”

To know more about this news, check out Rust’s official post.

Read Next

Introducing RustPython, a Python 3 interpreter written in Rust

How Deliveroo migrated from Ruby to Rust without breaking production

Rust 1.32 released with a print debugger and other changes