1.43.0 #
- Released on: 23 April, 2020
- Branched from master on: 6 March, 2020
Language #
- Fixed using binary operations with &{number}(e.g.&1.0) not having the type inferred correctly.
- Attributes such as #[cfg()]can now be used onifexpressions.
Syntax only changes
- Allow type Foo: Ordsyntactically.
- Fuse associated and extern items up to defaultness.
- Syntactically allow selfin allfncontexts.
- Merge fnsyntax + cleanup item parsing.
- itemmacro fragments can be interpolated into- traits,- impls, and- externblocks. For example, you may now write:- 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. 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 includingunused-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.
- rustc now buffers errors/warnings printed in JSON.
Libraries #
- Arc<[T; N]>,- Box<[T; N]>, and- Rc<[T; N]>, now implement- TryFrom<Arc<[T]>>,- TryFrom<Box<[T]>>, and- TryFrom<Rc<[T]>>respectively. Note These conversions are only available when- Nis- 0..=32.
- You can now use associated constants on floats and integers directly, rather
than having to import the module. e.g. You can now write u32::MAXorf32::NANwith no imports.
- u8::is_asciiis now- const.
- Stringnow implements- AsMut<str>.
- Added the primitivemodule tostdandcore. 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.
- string::FromUtf8Errornow implements- Clone + Eq.
Stabilized APIs #
Cargo #
- You can now set config [profile]s in your.cargo/config, or through your environment.
- Cargo will now set CARGO_BIN_EXE_<name>pointing to a binary’s executable path when running integration tests or benchmarks.<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, and have been moved to theunconditional_panicandarithmetic_overflowlints.
Compatibility Notes #
- Having trailing syntax in the assert!macro is now a hard error. 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.
- 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.