about summary refs log tree commit diff
path: root/tests/ui/patchable-function-entry/patchable-function-entry-flags.rs
diff options
context:
space:
mode:
authorllogiq <bogusandre@gmail.com>2025-02-09 23:12:29 +0000
committerGitHub <noreply@github.com>2025-02-09 23:12:29 +0000
commit521a8001cab373329752d3b4cdfca24de97ceee5 (patch)
treea7cad53ecd0f64da4ebf635551cf46fedb85476b /tests/ui/patchable-function-entry/patchable-function-entry-flags.rs
parentc3239baed0a59af202a313c6b474a16780eb4819 (diff)
parent5d2fe079ab8cbc8aaea26932d978d76b09b24f3f (diff)
downloadrust-521a8001cab373329752d3b4cdfca24de97ceee5.tar.gz
rust-521a8001cab373329752d3b4cdfca24de97ceee5.zip
Fix `let_and_return` with temporary variables, and distinguish between Rust editions (#14180)
The first commit fixes #14164 by making sure that temporaries with
non-static references are also looked for in expressions coming from
expansion. The shortcut that was done skipped those parts and reported
an absence of short-lived temporaries, which was incorrect.

The second commit distinguishes between edition 2024 and earlier ones.
Starting from edition 2024, the problematic drop order has been fixed,
and block variables, which might be referenced in a block expression,
are freed after the block expression itself. This allows more
`let_and_return` cases to be reported starting with edition 2024,
whereas in earlier editions an intermediary variable was necessary to
reorder the drops.

Incidentally, since Clippy is compiled in edition 2024 mode, the second
commit has led to a fix in
`clippy_lints/src/matches/significant_drop_in_scrutinee.rs`.

changelog: [`let_and_return`]: lint more cases in edition 2024, and fix
a false positive involving short-lived block temporary variables in
earlier editions.
Diffstat (limited to 'tests/ui/patchable-function-entry/patchable-function-entry-flags.rs')
0 files changed, 0 insertions, 0 deletions