Rust 1.47 releases with traits on larger arrays, shorter backtraces, support for LLVM 11, and more


Today, the Rust team announced the release of Rust 1.47. Though no new features, this release does come with compact backtraces, traits on larger arrays, support for Control Flow Guard on Windows, and much more.

Here are a few highlights from the release:


Traits on larger arrays


The previous versions of Rust did not support to be generic over integer values. This has been an especially pressing problem when implementing arrays because arrays have an integer as part of their type. 


For example, [T; N] is an array of type T of N length. As there is no way to be generic over N, you have to manually implement traits for arrays for every N you want to support. The standard library used to support up to N of 32.


To allow developers to be generic over N, the team has been working on a feature called const generics. It refers to generics that are constant values, rather than types. With this feature, you can parameterize types by, for example, specific integer values. Also, it allows implementing traits and functions that are abstract over those values.


The const generics feature is not stable yet. With its core implemented in the compiler, it is in good shape to be used by the standard library for implementing traits on arrays of any length.


Want to know more about const generics? Check out this post.


Compact panic! backtraces


Previously, the Rust backtrace panic output contained a lot of stuff that was often not much use to the developers. The verbose backtraces also made it harder to find the actual issue.


With this release, the backtraces would be more compact, making it much easier to find where exactly the panic originated. If you want to see the full backtrace, you can set RUST_BACKTRACE=full.


Upgraded to LLVM 11 and FreeBSD 11.4


Rust 1.47 supports LLVM 11 and FreeBSD 11.4. It still supports LLVM versions as old as 8, but by default, you will get LLVM 11.


Control Flow Guard on Windows


This release comes with support for Control Flow Guard (CFG), a platform security feature to combat memory corruption vulnerabilities on Windows. You can use the -C control-flow-guard option. 


Library stabilization and const-ifications


Along with these updates, several libraries have been stabilized including Ident::new_rawRange::is_emptyRangeInclusive::is_emptyResult::as_derefResult::as_deref_mutVec::leak, and more. Also, the previously stable APIs are now const-itified.


A few updates in Cargo


  • Cargo's build-dependencies are now built with optimization level 0 by default instead of matching the profile of the final binary.
  • cargo-help will now display man pages for commands rather just the --help text.
  • cargo-metadata now emits a test field indicating if a target has tests enabled.


Read the official announcement by the Rust team to know more. Also, check out the Rust 1.47 release notes to view all the updates in this release.



Comments