Rust is een programmeertaal bedacht door Graydon Hoare en oorspronkelijk ontwikkeld door Mozilla. Het is deels geïnspireerd op de programmeertaal C, maar kent syntactische en semantische verschillen. Het focust op veiligheid en moet moderne computersystemen efficiënter benutten. Het wordt onder meer ingezet door Cloudflare, OVH, Mozilla, Deliveroo, Coursera, AppSignal en Threema. Versie 1.92 is uitgebracht en de releasenotes voor die uitgave kunnen hieronder worden gevonden.
Deny-by-default never type lintsThe language and compiler teams continue to work on stabilization of the never type. In this release the
never_type_fallback_flowing_into_unsafeanddependency_on_unit_never_type_fallbackfuture compatibility lints were made deny-by-default, meaning they will cause a compilation error when detected. It's worth noting that while this can result in compilation errors, it is still a lint; these lints can all be#[allow]ed. These lints also will only fire when building the affected crates directly, not when they are built as dependencies (though a warning will be reported by Cargo in such cases).These lints detect code which is likely to be broken by the never type stabilization. It is highly advised to fix them if they are reported in your crate graph. We believe there to be approximately 500 crates affected by this lint. Despite that, we believe this to be acceptable, as lints are not a breaking change and it will allow for stabilizing the never type in the future. For more in-depth justification, see the Language Team's assessment.
unused_must_useno longer warns aboutResult<(), UninhabitedType>Rust's
unused_must_uselint warns when ignoring the return value of a function, if the function or its return type is annotated with#[must_use]. For instance, this warns if ignoring a return type ofResult, to remind you to use?, or something like.expect("...").However, some functions return
Result, but the error type they use is not actually "inhabited", meaning you cannot construct any values of that type (e.g. the!orInfallibletypes). Theunused_must_uselint now no longer warns onResult<(), UninhabitedType>, or onControlFlow<UninhabitedType, ()>. For instance, it will not warn onResult<(), Infallible>. This avoids having to check for an error that can never happen.use core::convert::Infallible; fn can_never_fail() -> Result<(), Infallible> { // ... Ok(()) } fn main() { can_never_fail(); }This is particularly useful with the common pattern of a trait with an associated error type, where the error type may sometimes be infallible:
Emit unwind tables even whentrait UsesAssocErrorType { type Error; fn method(&self) -> Result<(), Self::Error>; } struct CannotFail; impl UsesAssocErrorType for CannotFail { type Error = core::convert::Infallible; fn method(&self) -> Result<(), Self::Error> { Ok(()) } } struct CanFail; impl UsesAssocErrorType for CanFail { type Error = std::io::Error; fn method(&self) -> Result<(), Self::Error> { Err(std::io::Error::other("something went wrong")) } } fn main() { CannotFail.method(); // No warning CanFail.method(); // Warning: unused `Result` that must be used }-Cpanic=abortis enabled on linuxBacktraces with
Validate input to-Cpanic=abortpreviously worked in Rust 1.22 but were broken in Rust 1.23, as we stopped emitting unwind tables with-Cpanic=abort. In Rust 1.45 a workaround in the form of-Cforce-unwind-tables=yeswas stabilized. In Rust 1.92 unwind tables will be emitted by default even when-Cpanic=abortis specified, allowing for backtraces to work properly. If unwind tables are not desired then users should use-Cforce-unwind-tables=noto explicitly disable them being emitted.#[macro_export]Over the past few releases, many changes were made to the way built-in attributes are processed in the compiler. This should greatly improve the error messages and warnings Rust gives for built-in attributes and especially make these diagnostics more consistent among all of the over 100 built-in attributes. To give a small example, in this release specifically, Rust became stricter in checking what arguments are allowed to
Stabilized APIsmacro_exportby upgrading that check to a "deny-by-default lint" that will be reported in dependencies.
NonZero<u{N}>::div_ceilLocation::file_as_c_strRwLockWriteGuard::downgradeBox::new_zeroedBox::new_zeroed_sliceRc::new_zeroedRc::new_zeroed_sliceArc::new_zeroedArc::new_zeroed_slicebtree_map::Entry::insert_entrybtree_map::VacantEntry::insert_entryimpl Extend<proc_macro::Group> for proc_macro::TokenStreamimpl Extend<proc_macro::Literal> for proc_macro::TokenStreamimpl Extend<proc_macro::Punct> for proc_macro::TokenStreamimpl Extend<proc_macro::Ident> for proc_macro::TokenStreamThese previously stable APIs are now stable in const contexts:
Other changesCheck out everything that changed in Rust, Cargo, and Clippy.
