-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-async_drop`#![feature(async_drop)]``#![feature(async_drop)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried this code:
#![feature(async_drop)]
use std::future::AsyncDrop;
use std::pin::Pin;
#[tokio::main(flavor = "current_thread")]
async fn main() {
let _st = St;
}
struct St;
impl AsyncDrop for St {
async fn drop(self: Pin<&mut Self>) {
println!("123");
}
}
I expected to see this happen:
should print 123
Instead, this happened:
nothing
if try this codes
#![feature(async_drop)]
use std::future::AsyncDrop;
use std::pin::Pin;
#[tokio::main(flavor = "current_thread")]
async fn main() {
let _st = St;
}
struct St;
impl Drop for St {
fn drop(&mut self) {
println!("456")
}
}
impl AsyncDrop for St {
async fn drop(self: Pin<&mut Self>) {
println!("123");
}
}
it print 123
Meta
rustc --version --verbose
:
rustc 1.88.0-nightly (2e6882ac5 2025-05-05)
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-async_drop`#![feature(async_drop)]``#![feature(async_drop)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.