1.97.0
Rust 1.97.0
Release Notes
Language
- Consider
Result<T, Uninhabited>andControlFlow<Uninhabited, T>to be equivalent toTfor must use lint - Add allow-by-default
dead_code_pub_in_binarylint for unused pub items in binary crates - Stabilize the
div32,lam-bh,lamcas,ld-seq-saandscqtarget features - Stabilize
cfg(target_has_atomic_primitive_alignment) - Allow trailing
selfin imports in more cases
Platform Support
Refer to Rust's platform support page for more information on Rust's tiered platform support.
Stabilized APIs
Default for RepeatNCopy for ffi::FromBytesUntilNulErrorSend for std::fs::Fileon UEFI<{integer}>::isolate_highest_one<{integer}>::isolate_lowest_one<{integer}>::highest_one<{integer}>::lowest_one<{integer}>::bit_widthNonZero<{integer}>::isolate_highest_oneNonZero<{integer}>::isolate_lowest_oneNonZero<{integer}>::highest_oneNonZero<{integer}>::lowest_oneNonZero<{integer}>::bit_width
These previously stable APIs are now stable in const contexts:
Cargo
- Stabilize
build.warningsconfig. This controls how lint warnings from local packages are treated. Useful for enforcing a warning-free build in CI, replacing-Dwarnings. docs - Stabilize
resolver.lockfile-pathconfig. This allows specifying the path to the lockfile to use when resolving dependencies. Useful when working with read-only source directories. docs - cargo-clean: Error when
--target-dirdoesn't look like a Cargo target directory. This prevents accidental deletion of non-target directories. - Add
-mshorthand for--manifest-path - Remove
curldependency fromcrates-iocrate
Rustdoc
Compatibility Notes
- Emit a future-compatibility warning when relying on
f32: From<{float}>to constrain{float} - Rust will use the v0 symbol mangling scheme by default. This may cause some tools (such as debuggers or profilers, especially with old versions) to fail to demangle symbols emitted by Rust. It may also cause the formatting of text in backtraces to change.
- Prevent deref coercions in
pin!, in order to prevent unsoundness. The most likely case where this might impact users is: writingpin!(x)wherexhas type&mut Twill now always correctly produce a value of typePin<&mut &mut T>, instead of sometimes allowing a coercion that produces a value of typePin<&mut T>. This coercion was previously incorrectly allowed since Rust 1.88.0. - Deprecate
std::charconstants and functions - Warn on linker output by default
- Remove hidden
f64methods which have been deprecated since 1.0 - report the
varargs_without_patternlint in deps - Forbid passing generic arguments to module path segments even if the module reexports a generic enum variant
- Error on invalid macho
link_sectionspecifier - The encoding of certain
enums have changed. This is not a breaking change, as it only applies toenums without layout guarantees, but is noted here as we've seen people impacted from having made assumptions about the layout algorithm. - Error on
#[export_name = "..."]where the name is empty - Syntactically reject tuple index shorthands in struct patterns
- validate
#[link_name = "..."]&#[link(name = "...")]parameters - On Windows, after calling
shutdownon a socket to shut down the write side, attempting to write to the socket will now produce aBrokenPipeerror rather thanOther. MapWSAESHUTDOWNtoio::ErrorKind::BrokenPipe