1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
error: relative drop order changing in Rust 2024
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:19:15
|
LL | match func().await {
| ^^^^^^^-----
| | |
| | this value will be stored in a temporary; let us call it `#3`
| | up until Edition 2021 `#3` is dropped last but will be dropped earlier in Edition 2024
| | this value will be stored in a temporary; let us call it `#1`
| | `#1` will be dropped later as of Edition 2024
| this value will be stored in a temporary; let us call it `#2`
| up until Edition 2021 `#2` is dropped last but will be dropped earlier in Edition 2024
| `__awaitee` calls a custom destructor
| `__awaitee` will be dropped later as of Edition 2024
...
LL | Err(e) => {}
| -
| |
| `e` calls a custom destructor
| `e` will be dropped later as of Edition 2024
LL | }
LL | }
| - now the temporary value is dropped here, before the local variables in the block or statement
|
= warning: this changes meaning in Rust 2024
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/temporary-tail-expr-scope.html>
note: `#2` invokes this custom destructor
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1
|
LL | / impl std::ops::Drop for Drop {
LL | | fn drop(&mut self) {}
LL | | }
| |_^
note: `#1` invokes this custom destructor
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1
|
LL | / impl std::ops::Drop for Drop {
LL | | fn drop(&mut self) {}
LL | | }
| |_^
note: `e` invokes this custom destructor
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1
|
LL | / impl std::ops::Drop for Drop {
LL | | fn drop(&mut self) {}
LL | | }
| |_^
= note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages
note: the lint level is defined here
--> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9
|
LL | #![deny(tail_expr_drop_order)]
| ^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
|