Programming language: Rust 1.57 – Do not panic!

Share your love

The Rust team has released version 1.57 of the programming language as planned, the second release after the start of the new Rust edition 2021 at the end of October. The most important innovations relate to the cargo package management and the initial stabilization of the panic!-Macros and, among other things, the stabilization of a number of APIs – here in particular the interface that is responsible for reserving background memory.

Die API try_reserve is intended to allow callers to use the backing memory for the types Vec, String, HashMap, HashSetv and VecDeque to assign fallible. This means that Rust does not abort the process if the global allocator fails. However, according to the blog entry, Rust does not guarantee that the kernel will actually allocate the returned memory.

Another innovation concerns the Rust package management, Cargo, which so far only has four profiles dev, release, test and bench knew From now on, Cargo also supports any profile with any name. User-defined profiles must specify a profile when they are created, the default settings of which they then inherit. Artifacts created with them end up in separate directories.

That panic!-Macro could not be used in compile-time contexts such as const fn to use. As of Rust 1.57, it is now considered stable, and at the same time other APIs from the standard library (such as assert!) now use in const. However, the entire formatting infrastructure is not yet as advanced as the blog entry notes.

Specifically, this means that developers use the macro panic! either with a static string or with a single interpolated one &strg-Value must be called, which is mandatory in curly braces {} to use is: panic!("...") respectively panic!"{}", a. The editors describe the stabilization of the macro as “minimal”, but hold out the prospect of further expanding this form of support in the future.

Read Also   Get back to using your webcam in Windows 10 with these tricks

It is considered set that the stabilization that has now been carried out makes assertions possible at compile time, for example to check the size of a type:

const _: () = assert!(std::mem::size_of::<u64>() == 8);
const _: () = assert!(std::mem::size_of::<u8>() == 1);

Since the changes from one edition to the next are rather moderate, the Rust team had already spoken out against the jump to a new main version at the first edition jump in 2018. The differences between editions and major versions explains an article on Mozilla Hacks from 2018.

Further changes and a list of all stabilized APIs are available in the blog post about the publication of the current version, all innovations can be refer to the release notes for Rust 1.57. As usual, developers who have already installed Rust can download the current release rustup update stable download. For newbies it is the rustup tool on the download page available separately.


(yeah)

Article Source

Share your love