|
| 1 | ++++ |
| 2 | +path = "2025/12/11/Rust-1.92.0" |
| 3 | +title = "Announcing Rust 1.92.0" |
| 4 | +authors = ["The Rust Release Team"] |
| 5 | +aliases = ["releases/1.92.0"] |
| 6 | + |
| 7 | +[extra] |
| 8 | +release = true |
| 9 | ++++ |
| 10 | + |
| 11 | +The Rust team is happy to announce a new version of Rust, 1.92.0. Rust is a programming language empowering everyone to build reliable and efficient software. |
| 12 | + |
| 13 | +If you have a previous version of Rust installed via `rustup`, you can get 1.92.0 with: |
| 14 | + |
| 15 | +```console |
| 16 | +$ rustup update stable |
| 17 | +``` |
| 18 | + |
| 19 | +If you don't have it already, you can [get `rustup`](https://www.rust-lang.org/install.html) from the appropriate page on our website, and check out the [detailed release notes for 1.92.0](https://doc.rust-lang.org/stable/releases.html#version-1920-2025-12-11). |
| 20 | + |
| 21 | +If you'd like to help us out by testing future releases, you might consider updating locally to use the beta channel (`rustup default beta`) or the nightly channel (`rustup default nightly`). Please [report](https://github.com/rust-lang/rust/issues/new/choose) any bugs you might come across! |
| 22 | + |
| 23 | +## What's in 1.92.0 stable |
| 24 | + |
| 25 | +### Deny-by-default never type lints |
| 26 | + |
| 27 | +The language and compiler teams continue to work on stabilization of the [never type](https://doc.rust-lang.org/stable/std/primitive.never.html). In this release the [`never_type_fallback_flowing_into_unsafe`](https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#dependency-on-unit-never-type-fallback) and [`dependency_on_unit_never_type_fallback`](https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#dependency-on-unit-never-type-fallback) future compatibility lints were made deny-by-default, meaning they will cause a compilation error when detected. |
| 28 | + |
| 29 | +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). |
| 30 | + |
| 31 | +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. |
| 32 | + |
| 33 | +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](https://github.com/rust-lang/rust/pull/146167#issuecomment-3363795006). |
| 34 | + |
| 35 | +### `unused_must_use` no longer warns about `Result<(), UninhabitedType>` |
| 36 | + |
| 37 | +Rust's `unused_must_use` lint 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 of `Result`, to remind you to use `?`, or something like `.expect("...")`. |
| 38 | + |
| 39 | +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 [`!`](https://doc.rust-lang.org/std/primitive.never.html) or [`Infallible`](https://doc.rust-lang.org/std/convert/enum.Infallible.html) types). |
| 40 | + |
| 41 | +The `unused_must_use` lint now no longer warns on `Result<(), UninhabitedType>`, or on `ControlFlow<UninhabitedType, ()>`. For instance, it will not warn on `Result<(), Infallible>`. This avoids having to check for an error that can never happen. |
| 42 | + |
| 43 | +```rust |
| 44 | +use core::convert::Infallible; |
| 45 | +fn can_never_fail() -> Result<(), Infallible> { |
| 46 | + // ... |
| 47 | + Ok(()) |
| 48 | +} |
| 49 | + |
| 50 | +fn main() { |
| 51 | + can_never_fail(); |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +This is particularly useful with the common pattern of a trait with an associated error type, where the error type may *sometimes* be infallible: |
| 56 | + |
| 57 | +```rust |
| 58 | +trait UsesAssocErrorType { |
| 59 | + type Error; |
| 60 | + fn method(&self) -> Result<(), Self::Error>; |
| 61 | +} |
| 62 | + |
| 63 | +struct CannotFail; |
| 64 | +impl UsesAssocErrorType for CannotFail { |
| 65 | + type Error = core::convert::Infallible; |
| 66 | + fn method(&self) -> Result<(), Self::Error> { |
| 67 | + Ok(()) |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +struct CanFail; |
| 72 | +impl UsesAssocErrorType for CanFail { |
| 73 | + type Error = std::io::Error; |
| 74 | + fn method(&self) -> Result<(), Self::Error> { |
| 75 | + Err(std::io::Error::other("something went wrong")) |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +fn main() { |
| 80 | + CannotFail.method(); // No warning |
| 81 | + CanFail.method(); // Warning: unused `Result` that must be used |
| 82 | +} |
| 83 | +``` |
| 84 | + |
| 85 | +### Emit unwind tables even when `-Cpanic=abort` is enabled on linux |
| 86 | + |
| 87 | +Backtraces with `-Cpanic=abort` previously 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=yes` was stabilized. |
| 88 | + |
| 89 | +In Rust 1.92 unwind tables will be emitted by default even when `-Cpanic=abort` is specified, allowing for backtraces to work properly. If unwind tables are not desired then users should use `-Cforce-unwind-tables=no` to explicitly disable them being emitted. |
| 90 | + |
| 91 | +### Validate input to `#[macro_export]` |
| 92 | + |
| 93 | +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. |
| 94 | + |
| 95 | +To give a small example, in this release specifically, Rust became stricter in checking what arguments are allowed to `macro_export` by [upgrading that check to a "deny-by-default lint" that will be reported in dependencies](https://github.com/rust-lang/rust/pull/143857). |
| 96 | + |
| 97 | +### Stabilized APIs |
| 98 | + |
| 99 | +- [`NonZero<u{N}>::div_ceil`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.div_ceil) |
| 100 | +- [`Location::file_as_c_str`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file_as_c_str) |
| 101 | +- [`RwLockWriteGuard::downgrade`](https://doc.rust-lang.org/stable/std/sync/struct.RwLockWriteGuard.html#method.downgrade) |
| 102 | +- [`Box::new_zeroed`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed) |
| 103 | +- [`Box::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed_slice) |
| 104 | +- [`Rc::new_zeroed`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed) |
| 105 | +- [`Rc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed_slice) |
| 106 | +- [`Arc::new_zeroed`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed) |
| 107 | +- [`Arc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed_slice) |
| 108 | +- [`btree_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/enum.Entry.html#method.insert_entry) |
| 109 | +- [`btree_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/struct.VacantEntry.html#method.insert_entry) |
| 110 | +- [`impl Extend<proc_macro::Group> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CGroup%3E-for-TokenStream) |
| 111 | +- [`impl Extend<proc_macro::Literal> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CLiteral%3E-for-TokenStream) |
| 112 | +- [`impl Extend<proc_macro::Punct> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CPunct%3E-for-TokenStream) |
| 113 | +- [`impl Extend<proc_macro::Ident> for proc_macro::TokenStream`](https://doc.rust-lang.org/stable/proc_macro/struct.TokenStream.html#impl-Extend%3CIdent%3E-for-TokenStream) |
| 114 | + |
| 115 | +These previously stable APIs are now stable in const contexts: |
| 116 | + |
| 117 | +- [`<[_]>::rotate_left`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_left) |
| 118 | +- [`<[_]>::rotate_right`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_right) |
| 119 | + |
| 120 | +### Other changes |
| 121 | + |
| 122 | +Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.92.0), [Cargo](https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-192-2025-12-11), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-192). |
| 123 | + |
| 124 | +## Contributors to 1.92.0 |
| 125 | + |
| 126 | +Many people came together to create Rust 1.92.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.92.0/) |
| 127 | + |
| 128 | +[platform-support]: https://doc.rust-lang.org/rustc/platform-support.html |
0 commit comments