2023-01-24 16:06:35 +08:00
|
|
|
error: `if let` assigns a shorter lifetime since Edition 2024
|
2024-11-28 09:47:37 -08:00
|
|
|
--> $DIR/lint-if-let-rescope-gated.rs:26:8
|
2023-01-24 16:06:35 +08:00
|
|
|
|
|
|
|
|
|
LL | if let Some(_value) = Droppy.get() {
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^------^^^^^^
|
|
|
|
|
| |
|
|
|
|
|
| this value has a significant drop implementation which may observe a major change in drop order and requires your discretion
|
|
|
|
|
|
|
|
|
|
|
= warning: this changes meaning in Rust 2024
|
2024-12-15 19:36:27 -08:00
|
|
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-if-let-scope.html>
|
2025-02-23 03:34:33 +00:00
|
|
|
note: value invokes this custom destructor
|
|
|
|
|
--> $DIR/lint-if-let-rescope-gated.rs:14:1
|
|
|
|
|
|
|
|
|
|
|
LL | / impl Drop for Droppy {
|
|
|
|
|
LL | | fn drop(&mut self) {
|
|
|
|
|
LL | | println!("dropped");
|
|
|
|
|
LL | | }
|
|
|
|
|
LL | | }
|
|
|
|
|
| |_^
|
2023-01-24 16:06:35 +08:00
|
|
|
help: the value is now dropped here in Edition 2024
|
2024-11-28 09:47:37 -08:00
|
|
|
--> $DIR/lint-if-let-rescope-gated.rs:30:5
|
2023-01-24 16:06:35 +08:00
|
|
|
|
|
2024-09-06 03:03:10 +08:00
|
|
|
LL | } else {
|
2023-01-24 16:06:35 +08:00
|
|
|
| ^
|
|
|
|
|
note: the lint level is defined here
|
2024-11-28 09:47:37 -08:00
|
|
|
--> $DIR/lint-if-let-rescope-gated.rs:10:9
|
2023-01-24 16:06:35 +08:00
|
|
|
|
|
|
|
|
|
LL | #![deny(if_let_rescope)]
|
|
|
|
|
| ^^^^^^^^^^^^^^
|
2024-09-13 02:43:49 +08:00
|
|
|
help: a `match` with a single arm can preserve the drop order up to Edition 2021
|
2023-01-24 16:06:35 +08:00
|
|
|
|
|
2024-09-13 02:43:49 +08:00
|
|
|
LL ~ match Droppy.get() { Some(_value) => {
|
|
|
|
|
LL |
|
|
|
|
|
LL |
|
|
|
|
|
LL |
|
|
|
|
|
LL ~ } _ => {
|
|
|
|
|
LL |
|
|
|
|
|
LL ~ }}
|
2023-01-24 16:06:35 +08:00
|
|
|
|
|
|
|
|
|
|
2024-09-13 02:43:49 +08:00
|
|
|
error: aborting due to 1 previous error
|
2023-01-24 16:06:35 +08:00
|
|
|
|