Update Dec 2, 2021 tracked by Updatify
Rust 1.57.0
Language
-
Macro attributes may follow
#[derive]and will see the original (pre-cfg) input. -
Accept curly-brace macros in expressions, like
m!{ .. }.method()andm!{ .. }?. - Allow panicking in constant evaluation.
-
Ignore derived
CloneandDebugimplementations during dead code analysis.
Compiler
- Create more accurate debuginfo for vtables.
-
Add
armv6k-nintendo-3dsat Tier 3*. -
Add
armv7-unknown-linux-uclibceabihfat Tier 3*. -
Add
m68k-unknown-linux-gnuat Tier 3*. -
Add SOLID targets at Tier 3*:
aarch64-kmc-solid_asp3,armv7a-kmc-solid_asp3-eabi,armv7a-kmc-solid_asp3-eabihf
* Refer to Rust’s platform support page for more information on Rust’s tiered platform support.
Libraries
-
Avoid allocations and copying in
Vec::leak -
Add
#[repr(i8)]toOrdering -
Optimize
File::read_to_endandread_to_string - Update to Unicode 14.0
-
Many more functions are marked
#[must_use], producing a warning when ignoring their return value. This helps catch mistakes such as expecting a function to mutate a value in place rather than return a new value.
Stabilised APIs
-
[T; N]::as_mut_slice -
[T; N]::as_slice -
collections::TryReserveError -
HashMap::try_reserve -
HashSet::try_reserve -
String::try_reserve -
String::try_reserve_exact -
Vec::try_reserve -
Vec::try_reserve_exact -
VecDeque::try_reserve -
VecDeque::try_reserve_exact -
Iterator::map_while -
iter::MapWhile -
proc_macro::is_available -
Command::get_program -
Command::get_args -
Command::get_envs -
Command::get_current_dir -
CommandArgs -
CommandEnvs
These APIs are now usable in const contexts:
Cargo
Compatibility notes
-
Ignore derived
CloneandDebugimplementations during dead code analysis. This will break some builds that set#![deny(dead_code)].
Internal changes
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.