Trust us: Rust 1.46 tries to provide stability in uncertain times

Rust 1.46

Despite changing employment circumstances of the core team and organisational shifts in the projects, programming language Rust is now available in version 1.46. Devs shouldn’t expect earth-shattering modifications, though.

Most of the major improvements indeed fall under a feature stabilisation headline. Rust 1.46 for example includes a stable #[track_caller] attribute that users can add to their functions in order to get more precise panic messages that include an accurate caller location. 

The release also allows developers to fit their const functions with if, match, and loop expressions as well as operators && and ||. Those additions can, amongst other things, reduce compile time. The option to coerce and cast to slices in const functions has been stabilised as well, and users are now free to leave out the parentheses when recursively indexing into tuples, which means that x.0.0 and (x.0).0 should do the same thing.

Looking into the libraries, String has learned to use From<char>, vec::IntoIter<T> and vec::Drain<’_, T> now implement AsRef<[T]>, and mem::forget has become a const fn. Apart from that, all integer types should come with stable leading_ones and trailing_ones methods, non-zero integer types now implement TryFrom for their zero-able equivalent, and (String, u16) now implements ToSocketAddrs. 

Advertisement

Meanwhile works on Option::zip and vec::Drain::as_slice have gotten to a point at which the Rust team feels comfortable calling these APIs stable as well. Rust’s package manager Cargo has seen the addition of a number of new environment variables, that provide developers with information on a package’s license, license path, as well as its binary and crate name when compiling a crate. 

Additional details can be found in the release notes, which also include some references to compatibility changes that could lead to a slightly different behaviour for some edge cases. They also include some information about the recent renaming of target configuration option abi_blacklist to unsupported_abis, which is meant to be more inclusive and precise. Further renamings are discussed, though their backwards incompatibility means they’ll likely only find their way into one of the next major releases, if at all.

Rust 1.46 is the first release since the programming language’s core team announced its plans to get a Rust Foundation up and running by the end of 2020. The step had already been discussed for a while. However, insecurities sparked by sponsor Mozilla’s change in business tactics seem to have put some pressure on the timeline of the effort. It mainly clarifies that Rust is – despite its Mozilla roots – an independent language. It also gives the team a better means to move their efforts forward, and might help to keep committers on board who feel Mozilla’s new direction isn’t for them.

- Advertisement -