Description
Code
I tried this code:
fn main() {
match std::pin::pin!(foo(&mut 0)) {
_f => {}
}
}
async fn foo(_s: &mut usize) {}
I expected to see this happen: Compiles without error
Instead, this happened:
error[E0716]: temporary value dropped while borrowed
--> src/main.rs:2:35
|
2 | match std::pin::pin!(foo(&mut 0)) {
| ------------------------^--
| | ||
| | |temporary value is freed at the end of this statement
| | creates a temporary value which is freed while still in use
| borrow later used here
|
= note: consider using a `let` binding to create a longer lived value
Version it worked on
It most recently worked on: 1.86.0-beta.6 (2025-03-16 8c7969a3ae4a292789a4)
Version with regression
rustc --version --verbose
:
rustc 1.87.0-nightly (227690a25 2025-03-16)
binary: rustc
commit-hash: 227690a258492c84ae9927d18289208d0180e62f
commit-date: 2025-03-16
host: aarch64-apple-darwin
release: 1.87.0-nightly
LLVM version: 20.1.0