Home Programming News Languages News Rust 1.28 is here with global allocators, nonZero types and more

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

0
1076
Rusted chain
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.

Learn Programming & Development with a Packt Subscription

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: a new Rust based OpenPGP library to secure your apps
Eclipse IDE’s Photon release will support Rust

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here