Das Rust-Team hat eine neue Korrekturversion von Rust, 1.41.1, veröffentlicht. Rust ist eine Programmiersprache, mit der jeder zuverlässige und effiziente Software erstellen kann.
Wenn Sie die vorherige Version von Rust mit Tools installiert haben rustup
, müssen Sie zum Upgrade auf Version 1.41.1 nur den folgenden Befehl ausführen:
rustup update stable
Wenn Sie es noch nicht installiert haben rustup
, können Sie es auf der entsprechenden Seite unserer Website installieren
Was ist in der stabilen Version 1.41.1 enthalten
Rust 1.41.1 ist zwei kritischen Regressionen gewidmet, die in Rust 1.41.0 aufgetreten sind: Fehler in der statischen Lebensdauer und falsche Kompilierung, die Segmentierungsfehler verursacht. Diese Regressionen wirken sich nicht auf frühere Versionen von Rust aus. Wir empfehlen Benutzern von Rust 1.41.0, so schnell wie möglich zu aktualisieren. Ein weiteres Problem im Zusammenhang mit der Interaktion zwischen Lebensdauern 'static
und Implementierung von Merkmalen war Copy
seit Rust 1.0 vorhanden und wird auch durch diese Version behoben.
static
Element Verification Failure
Rust 1.41.0, - static
, . , static
. , , , 'static
, static
:
static mut MY_STATIC: &'static u8 = &0;
fn main() {
let my_temporary = 42;
unsafe {
MY_STATIC = &my_temporary;
}
}
1.41.1 :
error[E0597]: `my_temporary` does not live long enough
--> src/main.rs:6:21
|
6 | MY_STATIC = &my_temporary;
| ------------^^^^^^^^^^^^^
| | |
| | borrowed value does not live long enough
| assignment requires that `my_temporary` is borrowed for `'static`
7 | }
8 | }
| - `my_temporary` dropped here while still borrowed
#69114 PR, .
Copy
'static
Rust 1.0 :
#[derive(Clone)]
struct Foo<'a>(&'a u32);
impl Copy for Foo<'static> {}
fn main() {
let temporary = 2;
let foo = (Foo(&temporary),);
drop(foo.0);
drop(foo.0);
}
Rust 1.41.1 PR, . :
error[E0597]: `temporary` does not live long enough
--> src/main.rs:7:20
|
7 | let foo = (Foo(&temporary),);
| ^^^^^^^^^^ borrowed value does not live long enough
8 | drop(foo.0);
| ----- copying this value requires that
| `temporary` is borrowed for `'static`
9 | drop(foo.0);
10 | }
| - `temporary` dropped here while still borrowed
- , Foo<'a>
, 'a
, Copy
, 'a: 'static
. temporary
'0
'static
, , Foo<'0>
Copy
, drop
.
, .
, Rust 1.41.0, . , , . , LLVM, LLVM 9 LLVM 10.
Rust 1.41.0 LLVM 9 Rust 1.41.1 , . : #69225.
1.41.1
, Rust 1.41.1. , !
Rust - .