Closed
Description
There may be a false-negative with tail-expr-drop-order
. Reproduction:
curl -L https://crates.io/api/v1/crates/faer-core/0.17.1/download | tar -xz
- cd
faer-core-0.17.1
- Set up cargo-features and a git repo:
git init . && sed -i '1i cargo-features = ["edition2024"]' Cargo.toml && git add . && git commit -m test
cargo fix --edition
On current nightly (2024-11-09), this generates a large number of warnings about tail-expr-drop-order. However, none of them are in the offending function swap_cols
. Additionally, after #131326, there are no warnings at all.
After switching to 2024, this yields an error:
error[E0716]: temporary value dropped while borrowed
--> src/lib.rs:10425:69
|
10425 | $crate::zip::ZipEq::new($crate::zip::ViewMut::view_mut(&mut { $head }), $crate::zipped!($($tail,)*))
| ^^^^^^^^^ - temporary value is freed at the end of this statement
| |
| creates a temporary value which is freed while still in use
|
::: src/permutation.rs:304:9
|
304 | / zipped!(
305 | | mat_a.const_cast().as_2d_mut(),
306 | | mat_b.const_cast().as_2d_mut(),
307 | | )
| |_________- in this macro invocation
308 | }
309 | .for_each(|unzipped!(mut a, mut b)| {
| -------- borrow later used by call
|
= note: consider using a `let` binding to create a longer lived value
= note: this error originates in the macro `zipped` (in Nightly builds, run with -Z macro-backtrace for more info)
Unfortunately that crate is a maze of types and generics, so it is a bit difficult to minimize.
I'm just assuming this is a tail expression drop change due to the shape of the error.
It does not seem related to the macro, since manually expanding it also does not change anything.
I would expect tail-expr-drop-order to at least warn something here.
Meta
rustc --version --verbose
:
rustc 1.84.0-nightly (59cec72a5 2024-11-08)
binary: rustc
commit-hash: 59cec72a57af178767a7b8e7f624b06cc50f1087
commit-date: 2024-11-08
host: aarch64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The 2024 editionArea: Lints (warnings about flaws in source code) such as unused_mut.Category: This is a bug.Diagnostics: An error or lint that should account for edition differences.`#![feature(shorter_tail_lifetimes)]`Lint: False negative (should have fired but didn't).Lint: tail_expr_drop_orderRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.