Rust 1.52.0
Language
- Added the
unsafe_op_in_unsafe_fn
lint, which checks whether the unsafe code in anunsafe fn
is wrapped in aunsafe
block. This lint is allowed by default, and may become a warning or hard error in a future edition. - You can now cast mutable references to arrays to a pointer of the same type as the element.
Compiler
Added tier 3* support for the following targets.
s390x-unknown-linux-musl
riscv32gc-unknown-linux-musl
&riscv64gc-unknown-linux-musl
powerpc-unknown-openbsd
* Refer to Rust's platform support page for more information on Rust's tiered platform support.
Libraries
OsString
now implementsExtend
andFromIterator
.cmp::Reverse
now has#[repr(transparent)]
representation.Arc<impl Error>
now implementserror::Error
.- All integer division and remainder operations are now
const
.
Stabilised APIs
Arguments::as_str
char::MAX
char::REPLACEMENT_CHARACTER
char::UNICODE_VERSION
char::decode_utf16
char::from_digit
char::from_u32_unchecked
char::from_u32
slice::partition_point
str::rsplit_once
str::split_once
The following previously stable APIs are now const
.
char::len_utf8
char::len_utf16
char::to_ascii_uppercase
char::to_ascii_lowercase
char::eq_ignore_ascii_case
u8::to_ascii_uppercase
u8::to_ascii_lowercase
u8::eq_ignore_ascii_case
Rustdoc
- Rustdoc lints are now treated as a tool lint, meaning that lints are now prefixed with
rustdoc::
(e.g.#[warn(rustdoc::broken_intra_doc_links)]
). Using the old style is still allowed, and will become a warning in a future release. - Rustdoc now supports argument files.
- Rustdoc now generates smart punctuation for documentation.
- You can now use "task lists" in Rustdoc Markdown. E.g.
- [x] Complete - [ ] Todo
Misc
- You can now pass multiple filters to tests. E.g.
cargo test -- foo bar
will run all tests that matchfoo
andbar
. - Rustup now distributes PDB symbols for the
std
library on Windows, allowing you to seestd
symbols when debugging.
Internal Only
These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.
- Check the result cache before the DepGraph when ensuring queries
- Try fast_reject::simplify_type in coherence before doing full check
- Only store a LocalDefId in some HIR nodes
- Store HIR attributes in a side table
Compatibility Notes
- Cargo build scripts are now forbidden from setting
RUSTC_BOOTSTRAP
. - Removed support for the
x86_64-rumprun-netbsd
target. - Deprecated the
x86_64-sun-solaris
target in favor ofx86_64-pc-solaris
. - Rustdoc now only accepts
,
,\t
as delimiters for specifying languages in code blocks. - Rustc now catches more cases of
pub_use_of_private_extern_crate
- Changes in how proc macros handle whitespace may lead to panics when used with older
proc-macro-hack
versions. Acargo update
should be sufficient to fix this in all cases. - Turn
#[derive]
into a regular macro attribute