Rust 1.45.0
Released on July 16, 2020
What's Changed
- [Out of range float to int conversions using
ashas been defined as a saturating - [
mem::Discriminantnow usesT's discriminant type instead of always - [Function like procedural macros can now be used in expression, pattern, and statement
- [You can now override individual target features through the
target-feature - [Added the
force-unwind-tablesflag.][69984] This option allows - [Added the
embed-bitcodeflag.][71716] This codegen flag allows rustc - [Added the
tinyvalue to thecode-modelcodegen flag.][72397] - [Added tier 3 support\* for the
mipsel-sony-psptarget.][72062] - [Added tier 3 support for the
thumbv7a-uwp-windows-msvctarget.][72133] - [Upgraded to LLVM 10.][67759]
- [
net::{SocketAddr, SocketAddrV4, SocketAddrV6}now implementsPartialOrd - [
proc_macro::TokenStreamnow implementsDefault.][72234] - [You can now use
charwith - [
OsStringnow implementsFromStr.][71662] - [The
saturating_negmethod has been added to all signed integer primitive - [
Arc,Rcnow implementFrom, and> Boxnow - [
Box<[T]>now implementsFrom<[T; N]>.][71095] - [
BitOrandBitOrAssignare implemented for allNonZero - [The
fetch_min, andfetch_maxmethods have been added to all atomic - [The
fetch_updatemethod has been added to all atomic integer types.][71843] - [
Arc::as_ptr] - [
BTreeMap::remove_entry] - [
Rc::as_ptr] - [
rc::Weak::as_ptr] - [
rc::Weak::from_raw] - [
rc::Weak::into_raw] - [
str::strip_prefix] - [
str::strip_suffix] - [
sync::Weak::as_ptr] - [
sync::Weak::from_raw] - [
sync::Weak::into_raw] - [
char::UNICODE_VERSION] - [
Span::resolved_at] - [
Span::located_at] - [
Span::mixed_site] - [
unix::process::CommandExt::arg0]
- [Cargo uses the
embed-bitcodeflag to optimize disk usage and build
- [Trying to self initialize a static value (that is creating a value using
- [
{f32, f64}::powinow returns a slightly different value on Windows.][73420] - [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
- [Rustc's
ltoflag is incompatible with the newembed-bitcode=no.][71848]
- [Rustdoc now supports strikethrough text in Markdown.][71928] E.g.
- [Added an emoji to Rustdoc's deprecated API message.][72014]
- [Make clippy a git subtree instead of a git submodule][70655]
- [Unify the undo log of all snapshot types][69464]
Full Changelog
Language
--------
- [Out of range float to int conversions using as has been defined as a saturating
conversion.][71269] This was previously undefined behaviour, but you can use the
{f64, f32}::to_int_unchecked methods to continue using the current behaviour, which
may be desirable in rare performance sensitive situations.
- [mem::Discriminant now uses T's discriminant type instead of always
using u64.][70705]
- [Function like procedural macros can now be used in expression, pattern, and statement
positions.][68717] This means you can now use a function-like procedural macro
anywhere you can use a declarative (macro_rules!) macro.
Compiler
--------
- [You can now override individual target features through the target-feature
flag.][72094] E.g. -C target-feature=+avx2 -C target-feature=+fma is now
equivalent to -C target-feature=+avx2,+fma.
- [Added the force-unwind-tables flag.][69984] This option allows
rustc to always generate unwind tables regardless of panic strategy.
- [Added the embed-bitcode flag.][71716] This codegen flag allows rustc
to include LLVM bitcode into generated rlibs (this is on by default).
- [Added the tiny value to the code-model codegen flag.][72397]
- [Added tier 3 support\* for the mipsel-sony-psp target.][72062]
- [Added tier 3 support for the thumbv7a-uwp-windows-msvc target.][72133]
- [Upgraded to LLVM 10.][67759]
\* Refer to Rust's [platform support page][platform-support-doc] for more
information on Rust's tiered platform support.
Libraries
---------
- [net::{SocketAddr, SocketAddrV4, SocketAddrV6} now implements PartialOrd
and Ord.][72239]
- [proc_macro::TokenStream now implements Default.][72234]
- [You can now use char with
ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo} to iterate over
a range of codepoints.][72413] E.g.
you can now write the following;
for ch in 'a'..='z' {
print!("{}", ch);
}
println!();
// Prints "abcdefghijklmnopqrstuvwxyz"
- [OsString now implements FromStr.][71662]
- [The saturating_neg method has been added to all signed integer primitive
types, and the saturating_abs method has been added for all integer
primitive types.][71886]
- [Arc, Rc now implement From, and Box now
implements From when T is [T: Copy], str, CStr, OsStr,
or Path.][71447]
- [Box<[T]> now implements From<[T; N]>.][71095]
- [BitOr and BitOrAssign are implemented for all NonZero
integer types.][69813]
- [The fetch_min, and fetch_max methods have been added to all atomic
integer types.][72324]
- [The fetch_update method has been added to all atomic integer types.][71843]
Stabilized APIs
---------------
- [Arc::as_ptr]
- [BTreeMap::remove_entry]
- [Rc::as_ptr]
- [rc::Weak::as_ptr]
- [rc::Weak::from_raw]
- [rc::Weak::into_raw]
- [str::strip_prefix]
- [str::strip_suffix]
- [sync::Weak::as_ptr]
- [sync::Weak::from_raw]
- [sync::Weak::into_raw]
- [char::UNICODE_VERSION]
- [Span::resolved_at]
- [Span::located_at]
- [Span::mixed_site]
- [unix::process::CommandExt::arg0]
Cargo
-----
- [Cargo uses the embed-bitcode flag to optimize disk usage and build
time.][cargo/8066]
Misc
----
- [Rustdoc now supports strikethrough text in Markdown.][71928] E.g.
~~outdated information~~ becomes "~~outdated information~~".
- [Added an emoji to Rustdoc's deprecated API message.][72014]
Compatibility Notes
-------------------
- [Trying to self initialize a static value (that is creating a value using
itself) is unsound and now causes a compile error.][71140]
- [{f32, f64}::powi now returns a slightly different value on Windows.][73420]
This is due to changes in LLVM's intrinsics which {f32, f64}::powi uses.
- [Rustdoc's CLI's extra error exit codes have been removed.][71900] These were
previously undocumented and not intended for public use. Rustdoc still provides
a non-zero exit code on errors.
- [Rustc's lto flag is incompatible with the new embed-bitcode=no.][71848]
This may cause issues if LTO is enabled through RUSTFLAGS or cargo rustc
flags while cargo is adding embed-bitcode itself. The recommended way to
control LTO is with Cargo profiles, either in Cargo.toml or .cargo/config,
or by setting CARGO_PROFILE_ in the environment.
Internals Only
--------------
- [Make clippy a git subtree instead of a git submodule][70655]
- [Unify the undo log of all snapshot types][69464]
[71848]: https://github.com/rust-lang/rust/issues/71848/
[73420]: https://github.com/rust-lang/rust/issues/73420/
[72324]: https://github.com/rust-lang/rust/pull/72324/
[71843]: https://github.com/rust-lang/rust/pull/71843/
[71886]: https://github.com/rust-lang/rust/pull/71886/
[72234]: https://github.com/rust-lang/rust/pull/72234/
[72239]: https://github.com/rust-lang/rust/pull/72239/
[72397]: https://github.com/rust-lang/rust/pull/72397/
[72413]: https://github.com/rust-lang/rust/pull/72413/
[72014]: https://github.com/rust-lang/rust/pull/72014/
[72062]: https://github.com/rust-lang/rust/pull/72062/
[72094]: https://github.com/rust-lang/rust/pull/72094/
[72133]: https://github.com/rust-lang/rust/pull/72133/
[67759]: https://github.com/rust-lang/rust/pull/67759/
[71900]: https://github.com/rust-lang/rust/pull/71900/
[71928]: https://github.com/rust-lang/rust/pull/71928/
[71662]: https://github.com/rust-lang/rust/pull/71662/
[71716]: https://github.com/rust-lang/rust/pull/71716/
[71447]: https://github.com/rust-lang/rust/pull/71447/
[71269]: https://github.com/rust-lang/rust/pull/71269/
[71095]: https://github.com/rust-lang/rust/pull/71095/
[71140]: https://github.com/rust-lang/rust/pull/71140/
[70655]: https://github.com/rust-lang/rust/pull/70655/
[70705]: https://github.com/rust-lang/rust/pull/70705/
[69984]: https://github.com/rust-lang/rust/pull/69984/
[69813]: https://github.com/rust-lang/rust/pull/69813/
[69464]: https://github.com/rust-lang/rust/pull/69464/
[68717]: https://github.com/rust-lang/rust/pull/68717/
[cargo/8066]: https://github.com/rust-lang/cargo/pull/8066
[Arc::as_ptr]: https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.as_ptr
[BTreeMap::remove_entry]: https://doc.rust-lang.org/stable/std/collections/struct.BTreeMap.html#method.remove_entry
[Rc::as_ptr]: https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.as_ptr
[rc::Weak::as_ptr]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.as_ptr
[rc::Weak::from_raw]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.from_raw
[rc::Weak::into_raw]: https://doc.rust-lang.org/stable/std/rc/struct.Weak.html#method.into_raw
[sync::Weak::as_ptr]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.as_ptr
[sync::Weak::from_raw]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.from_raw
[sync::Weak::into_raw]: https://doc.rust-lang.org/stable/std/sync/struct.Weak.html#method.into_raw
[str::strip_prefix]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_prefix
[str::strip_suffix]: https://doc.rust-lang.org/stable/std/primitive.str.html#method.strip_suffix
[char::UNICODE_VERSION]: https://doc.rust-lang.org/stable/std/char/constant.UNICODE_VERSION.html
[Span::resolved_at]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.resolved_at
[Span::located_at]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.located_at
[Span::mixed_site]: https://doc.rust-lang.org/stable/proc_macro/struct.Span.html#method.mixed_site
[unix::process::CommandExt::arg0]: https://doc.rust-lang.org/std/os/unix/process/trait.CommandExt.html#tymethod.arg0