Skip to content

Commit b2d9efc

Browse files
committed
Translate Rust-1.92.0.md via GitLocalize
1 parent b0f8990 commit b2d9efc

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

ru/announcements/Rust-1.92.0.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
Rust 1.92.0:<br>The Rust Release Team
2+
3+
[extra] release = true +++
4+
5+
Команда Rust рада сообщить о новой версии языка — 1.92.0. Rust — это язык программирования, позволяющий каждому создавать надёжное и эффективное программное обеспечение.
6+
7+
Если у вас есть предыдущая версия Rust, установленная через `rustup`, то для обновления до версии 1.92.0 вам достаточно выполнить команду:
8+
9+
```console
10+
$ rustup update stable
11+
```
12+
13+
Если у вас ещё не установлен `rustup`, вы можете установить его с [соответствующей страницы](https://www.rust-lang.org/install.html) нашего веб-сайта, а также посмотреть [подробные примечания к выпуску](https://doc.rust-lang.org/stable/releases.html#version-1920-2025-12-11) на GitHub.
14+
15+
Если вы хотите помочь нам протестировать будущие выпуски, вы можете использовать канал beta (`rustup default beta`) или nightly (`rustup default nightly`). Пожалуйста, [сообщайте](https://github.com/rust-lang/rust/issues/new/choose) обо всех встреченных вами ошибках.
16+
17+
## Что стабилизировано в 1.92.0
18+
19+
### Deny-by-default never type lints
20+
21+
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.
22+
23+
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).
24+
25+
Эти проверки обнаруживают код, который, вероятно, будет нарушен после стабилизации типа never. Настоятельно рекомендуется исправить их, если они обнаружены в вашем крейте.
26+
27+
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).
28+
29+
### `unused_must_use` больше не предупреждает о `Result<(), UninhabitedType>`
30+
31+
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("...")`.
32+
33+
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).
34+
35+
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.
36+
37+
```rust
38+
use core::convert::Infallible;
39+
fn can_never_fail() -> Result<(), Infallible> {
40+
// ...
41+
Ok(())
42+
}
43+
44+
fn main() {
45+
can_never_fail();
46+
}
47+
```
48+
49+
Это особенно полезно при использовании трейта с ассоциированным типом ошибки, где этот тип ошибки иногда *иногда* может быть непредотвратимым (infallible):
50+
51+
```rust
52+
trait UsesAssocErrorType {
53+
type Error;
54+
fn method(&self) -> Result<(), Self::Error>;
55+
}
56+
57+
struct CannotFail;
58+
impl UsesAssocErrorType for CannotFail {
59+
type Error = core::convert::Infallible;
60+
fn method(&self) -> Result<(), Self::Error> {
61+
Ok(())
62+
}
63+
}
64+
65+
struct CanFail;
66+
impl UsesAssocErrorType for CanFail {
67+
type Error = std::io::Error;
68+
fn method(&self) -> Result<(), Self::Error> {
69+
Err(std::io::Error::other("something went wrong"))
70+
}
71+
}
72+
73+
fn main() {
74+
CannotFail.method(); // Без предупреждения
75+
CanFail.method(); // Предупреждение: unused `Result` that must be used
76+
}
77+
```
78+
79+
### Генерация таблицы раскрутки стека на Linux даже при включённом `-Cpanic=abort`
80+
81+
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.
82+
83+
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.
84+
85+
### Валидация `#[macro_export]`
86+
87+
За последние несколько релизов было внесено множество изменений в то, как встроенные атрибуты обрабатываются в компиляторе. Это должно значительно улучшить сообщения об ошибках и предупреждениях, которые Rust выдаёт для встроенных атрибутов, и особенно сделать эту диагностику более согласованной среди более чем 100 встроенных атрибутов.
88+
89+
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).
90+
91+
### Стабилизированные API
92+
93+
- [`NonZero<u{N}>::div_ceil`](https://doc.rust-lang.org/stable/std/num/struct.NonZero.html#method.div_ceil)
94+
- [`Location::file_as_c_str`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file_as_c_str)
95+
- [`RwLockWriteGuard::downgrade`](https://doc.rust-lang.org/stable/std/sync/struct.RwLockWriteGuard.html#method.downgrade)
96+
- [`Box::new_zeroed`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed)
97+
- [`Box::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.new_zeroed_slice)
98+
- [`Rc::new_zeroed`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed)
99+
- [`Rc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.new_zeroed_slice)
100+
- [`Arc::new_zeroed`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed)
101+
- [`Arc::new_zeroed_slice`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.new_zeroed_slice)
102+
- [`btree_map::Entry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/enum.Entry.html#method.insert_entry)
103+
- [`btree_map::VacantEntry::insert_entry`](https://doc.rust-lang.org/stable/std/collections/btree_map/struct.VacantEntry.html#method.insert_entry)
104+
- [`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)
105+
- [`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)
106+
- [`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)
107+
- [`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)
108+
109+
Следующие API теперь можно использовать в контексте `const`:
110+
111+
- [`<[_]>::rotate_left`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_left)
112+
- [`<[_]>::rotate_right`](https://doc.rust-lang.org/stable/std/primitive.slice.html#method.rotate_right)
113+
114+
### Прочие изменения
115+
116+
Проверьте всё, что изменилось в [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) и [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-192).
117+
118+
## Кто работал над 1.92.0
119+
120+
Многие люди собрались вместе, чтобы создать Rust 1.92.0. Без вас мы бы не справились. [Спасибо!](https://thanks.rust-lang.org/rust/1.92.0/)

0 commit comments

Comments
 (0)