Would you like some polish with that? Rust 1.47 shortens backtraces, looks into large array traits

Would you like some polish with that? Rust 1.47 shortens backtraces, looks into large array traits

Rust 1.47 is here and while there aren’t any new language features, the compiler improvements and some library enhancements are meant to make developers’ lives easier.

According to the Rust Release Team, the traits in the standard library are now “implemented for arrays of any length, not just those of length less than 33”. This is a long awaited feature that comes as part of the const generic implementation which, once ready, is expected to provide a way to be generic over integer values to reduce problems with arrays.

The resident techies also highlighted that 1.47 has fixed some backtrace issues, which make backtraces a bit more concise and therefore more helpful when the origin of a panic is sought. The library has gained implementations for Copy, Clone, Eq, Hash, Ord, PartialEq, and PartialOrd in panic::Location. Other library enhancements include partial slicing via Index<RangeFrom<usize>> in CStr and a Default in ops::RangeFull and ops::Range.

Delving into the compiler, it has been upgraded to work with LLVM 11 by default and comes with a stabilised -C control-flow-guard codegen option to enable Control Flow Guard on Windows. Since FreeBSD 10 reached its end of life in 2018 and its old toolchain caused issues with the LLVM upgrade, the toolchain version was updated to 11.4 to make everything work. There’s now also tier 3 support for the thumbv4t-none-eabi target available.

A majority of the work in the last couple of weeks seems to have focused on stabilising APIs such as Ident::new_raw, Range::is_empty, RangeInclusive::is_empty, Result::as_deref, Result::as_deref_mut, Vec::leak, pointer::offset_from, f32::TAU, and f64::TAU. 

The new method for all NonZero integers and checked_add,checked_sub,checked_mul,checked_neg, checked_shl, checked_shr, saturating_add, saturating_sub, and saturating_mul methods for all integers have been made const. The same goes for checked_abs, saturating_abs, saturating_neg, and signum for all signed integers, as well is_ascii_alphabetic, is_ascii_uppercase, is_ascii_lowercase, is_ascii_alphanumeric, is_ascii_digit, is_ascii_hexdigit, is_ascii_punctuation, is_ascii_graphic, is_ascii_whitespace, and is_ascii_control methods for char and u8.

Rust is a programming language originally developed at Mozilla, which was first introduced to the public in 2010 and became a company-independent project in 2015. In recent months the project has largely drawn attention because of the job cuts caused by Mozilla’s reformulation of business goals which also hit the core Rust team. 

To help the project pull through and clarify its status, Rust is planning to have a foundation handle its affairs, which is expects to be up and running by the end of the year.