Rust versions / 1.52
Rust release · May 6, 2021
Rust 1.52: what's new, what was stabilized
Short answerRust 1.52 was released on May 6, 2021: 19 newly stable APIs (Arguments::as_str, char::MAX, char::REPLACEMENT_CHARACTER, char::UNICODE_VERSION, ...); 7 compatibility notes that can affect existing code. Point release: 1.52.1 (May 10, 2021).
← Rust 1.51All versionsRust 1.53 →
19 APIs stabilized
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, 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
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- [Cargo build scripts are now forbidden from setting
RUSTC_BOOTSTRAP.][cargo/9181] - [Removed support for the
x86_64-rumprun-netbsdtarget.][82594] - [Deprecated the
x86_64-sun-solaristarget in favor ofx86_64-pc-solaris.][82216] - [Rustdoc now only accepts
,,, and\tas delimiters for specifying - [Rustc now catches more cases of
pub_use_of_private_extern_crate][80763] - [Changes in how proc macros handle whitespace may lead to panics when used
- [Turn
#[derive]into a regular macro attribute][79078]
Use it
rustup update stable # get the newest release
rustup install 1.52 # or exactly this one
rustup override set 1.52 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.52" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- [Added the
unsafe_op_in_unsafe_fnlint, which checks whether the unsafe code in anunsafe fnis wrapped in aunsafeblock.][79208] 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.][81479]
Compiler
- [Upgraded the default LLVM to LLVM 12.][81451]
Added tier 3\* support for the following targets.
- [
s390x-unknown-linux-musl][82166] - [
riscv32gc-unknown-linux-musl&riscv64gc-unknown-linux-musl][82202] - [
powerpc-unknown-openbsd][82733]
\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.
Libraries
- [
OsStringnow implementsExtendandFromIterator.][82121] - [
cmp::Reversenow has#[repr(transparent)]representation.][81879] - [
Arc<impl Error>now implementserror::Error.][80553] - [All integer division and remainder operations are now
const.][80962]
Stabilized 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)]).][80527] Using the old style is still allowed, and will become a warning in a future release. - [Rustdoc now supports argument files.][82261]
- [Rustdoc now generates smart punctuation for documentation.][79423]
- [You can now use "task lists" in Rustdoc Markdown.][81766] E.g. ```markdown
- [x] Complete
- [ ] Todo ```
Misc
- [You can now pass multiple filters to tests.][81356] E.g.
cargo test -- foo barwill run all tests that matchfooandbar. - [Rustup now distributes PDB symbols for the
stdlibrary on Windows, allowing you to seestdsymbols when debugging.][82218]
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][81855]
- [Try fast_reject::simplify_type in coherence before doing full check][81744]
- [Only store a LocalDefId in some HIR nodes][81611]
- [Store HIR attributes in a side table][79519]
Compatibility Notes
- Cargo build scripts are now forbidden from setting
RUSTC_BOOTSTRAP. - Removed support for the
x86_64-rumprun-netbsdtarget. - Deprecated the
x86_64-sun-solaristarget in favor ofx86_64-pc-solaris. - Rustdoc now only accepts
,,, and\tas 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-hackversions. Acargo updateshould be sufficient to fix this in all cases. - [Turn
#[derive]into a regular macro attribute]79078
1.52.1 (May 10, 2021)
This release disables incremental compilation, unless the user has explicitly opted in via the newly added RUSTC_FORCE_INCREMENTAL=1 environment variable.
This is due to the widespread, and frequently occurring, breakage encountered by Rust users due to newly enabled incremental verification in 1.52.0. Notably, Rust users **should** upgrade to 1.52.0 or 1.52.1: the bugs that are detected by newly added incremental verification are still present in past stable versions, and are not yet fixed on any channel. These bugs can lead to miscompilation of Rust binaries.
These problems only affect incremental builds, so release builds with Cargo should not be affected unless the user has explicitly opted into incremental. Debug and check builds are affected.
See 84970 for more details.
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.53Released Jun 17, 2021.Read it next →Also worth your time
Did this answer your question?