Rust versions / 1.43
Rust release · Apr 23, 2020
Rust 1.43: what's new, what was stabilized
Short answerRust 1.43 was released on Apr 23, 2020: 6 newly stable APIs (Once::is_completed, f32::LOG10_2, f32::LOG2_10, f64::LOG10_2, ...); 2 compatibility notes that can affect existing code. Point release: 1.43.1 (May 7, 2020).
← Rust 1.42All versionsRust 1.44 →
6 APIs stabilized
Once::is_completed, f32::LOG10_2, f32::LOG2_10, f64::LOG10_2, f64::LOG2_10, iter::once_with
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:
- [Having trailing syntax in the
assert!macro is now a hard error.][69548] This - [Fixed
Selfnot having the correctly inferred type.][69340] This incorrectly
Use it
rustup update stable # get the newest release
rustup install 1.43 # or exactly this one
rustup override set 1.43 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.43" 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
- [Fixed using binary operations with
&{number}(e.g.&1.0) not having the type inferred correctly.][68129] - [Attributes such as
#[cfg()]can now be used onifexpressions.][69201]
**Syntax only changes**
- [Allow
type Foo: Ordsyntactically.][69361] - [Fuse associated and extern items up to defaultness.][69194]
- [Syntactically allow
selfin allfncontexts.][68764] - [Merge
fnsyntax + cleanup item parsing.][68728] - [
itemmacro fragments can be interpolated intotraits,impls, andexternblocks.][69366] For example, you may now write: ``rust macro_rules! mac_trait { ($i:item) => { trait T { $i } } } mac_trait! { fn foo() {} }``
These are still rejected *semantically*, so you will likely receive an error but these changes can be seen and parsed by macros and conditional compilation.
Compiler
- [You can now pass multiple lint flags to rustc to override the previous flags.][67885] For example;
rustc -D unused -A unused-variablesdenies everything in theunusedlint group exceptunused-variableswhich is explicitly allowed. However, passingrustc -A unused-variables -D unuseddenies everything in theunusedlint group **including**unused-variablessince the allow flag is specified before the deny flag (and therefore overridden). - [rustc will now prefer your system MinGW libraries over its bundled libraries if they are available on
windows-gnu.][67429] - [rustc now buffers errors/warnings printed in JSON.][69227]
Libraries
- [
Arc<[T; N]>,Box<[T; N]>, andRc<[T; N]>, now implementTryFrom<Arc<[T]>>,TryFrom<Box<[T]>>, andTryFrom<Rc<[T]>>respectively.][69538] **Note** These conversions are only available whenNis0..=32. - [You can now use associated constants on floats and integers directly, rather than having to import the module.][68952] e.g. You can now write
u32::MAXorf32::NANwith no imports. - [
u8::is_asciiis nowconst.][68984] - [
Stringnow implementsAsMut<str>.][68742] - [Added the
primitivemodule tostdandcore.][67637] This module reexports Rust's primitive types. This is mainly useful in macros where you want avoid these types being shadowed. - [Relaxed some of the trait bounds on
HashMapandHashSet.][67642] - [
string::FromUtf8Errornow implementsClone + Eq.][68738]
Stabilized APIs
- [
Once::is_completed] - [
f32::LOG10_2] - [
f32::LOG2_10] - [
f64::LOG10_2] - [
f64::LOG2_10] - [
iter::once_with]
Cargo
- [You can now set config
[profile]s in your.cargo/config, or through your environment.][cargo/7823] - [Cargo will now set
CARGO_BIN_EXE_<name>pointing to a binary's executable path when running integration tests or benchmarks.][cargo/7697]<name>is the name of your binary as-is e.g. If you wanted the executable path for a binary namedmy-programyou would useenv!("CARGO_BIN_EXE_my-program").
Misc
- [Certain checks in the
const_errlint were deemed unrelated to const evaluation][69185], and have been moved to theunconditional_panicandarithmetic_overflowlints.
Compatibility Notes
- [Having trailing syntax in the
assert!macro is now a hard error.][69548] This has been a warning since 1.36.0. - Fixed
Selfnot having the correctly inferred type. This incorrectly led to some instances being accepted, and now correctly emits a hard error.
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.
- All components are now built with
opt-level=3instead of2. - Improved how rustc generates drop code.
- [Improved performance from
#[inline]-ing certain hot functions.]69256 - traits: preallocate 2 Vecs of known initial size
- Avoid exponential behaviour when relating types
- Skip
Dropterminators for enum variants without drop glue - Improve performance of coherence checks
- Deduplicate types in the generator witness
- Invert control in struct_lint_level.
1.43.1 (May 7, 2020)
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.44Released Jun 4, 2020.Read it next →Also worth your time
Did this answer your question?