News

Rust 1.28 is here with global allocators, nonZero types and more

1 min read

The Rust team has announced a new version of their popular programming language. Mozilla’s Rust system programming language has always been focused on safety, speed, and concurrency. This release adds more power to these features. Rust 1.28 provides more flexibility and ease to memory allocation with global allocators and NonZero types.

Global allocators

Global allocators allow a developer to define the memory allocation system used by a Rust program.  Previously, Rust did not allow changing the way memory is obtained, which prevented some use cases.

With Rust 1.28, the #[global_allocator] attribute is stable. This attribute will allow Rust programs to set their allocator to the system allocator, as well as define new allocators by implementing the GlobalAlloc trait.

Better error message formatting

Rust’s compiler has traditionally provided verbose and explicit error messages, along with suggestions for how to fix the problem.  Rust 1.28 introduces more detailed notes about why some error conditions arise.

The entire list of formatting changes is available on Github.

Library stabilizations

NonZero types are now a stable addition to the language. NonZero number types are wrappers around the standard unsigned integer types: NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, and NonZeroUsize. This provides easier to anticipate memory allocations and optimize program data placement.

A number of other libraries have also been stabilized; you can see the more detailed release notes for full details.

Cargo features

Rust’s cargo utility no longer lets users publish crates with build scripts that modify the src directory for an application. This eliminates bugs during the compilation process.

For more detailed release notes along with code snippets, you can read the Rust Language blog.

Read Next

Will Rust Replace C++?
Say hello to Sequoia: new Rust based OpenPGP library to secure your apps
Eclipse IDE’s Photon release will support Rust

Sugandha Lahoti

Content Marketing Editor at Packt Hub. I blog about new and upcoming tech trends ranging from Data science, Web development, Programming, Cloud & Networking, IoT, Security and Game development.

Share
Published by
Sugandha Lahoti

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago