-
Notifications
You must be signed in to change notification settings - Fork 13.3k
when dependency enable async_drop feature, it cause ICE #140858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
C-bug
Category: This is a bug.
F-async_drop
`#![feature(async_drop)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-incomplete-features
This issue requires the use of incomplete features.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
I write a reproducible codes rustc version
dep alib.rs // #![cfg_attr(feature = "async_drop", feature(async_drop))]
// #![cfg_attr(feature = "async_drop", allow(incomplete_features))]
#![feature(async_drop)]
#![allow(incomplete_features)]
pub struct St;
impl St {
pub async fn p(&self) {
println!("async");
}
}
impl Drop for St {
fn drop(&mut self) {
println!("456")
}
}
// #[cfg(feature = "async_drop")]
impl std::future::AsyncDrop for St {
async fn drop(self: std::pin::Pin<&mut Self>) {
doit().await;
println!("123");
}
}
async fn doit() {
println!("123");
} project bCargo.toml [package]
name = "b"
version = "0.1.0"
edition = "2024"
[dependencies]
a = { path = "../a" }
tokio = { version = "1.45.0", features = ["rt", "macros"] } main.rs #![feature(async_drop)]
#![allow(incomplete_features)]
#[tokio::main(flavor = "current_thread")]
async fn main() {
doit().await
}
async fn doit() {
let st = a::St{};
st.p().await;
}
|
cc @azhogin |
Smaller, and with no deps: // src/lib.rs
#![feature(async_drop)]
#![allow(incomplete_features)]
pub struct St;
impl Drop for St {
fn drop(&mut self) { }
}
impl std::future::AsyncDrop for St {
async fn drop(self: std::pin::Pin<&mut Self>) { }
} // src/main.rs
#![feature(async_drop)]
#![allow(incomplete_features)]
async fn doit() {
let st = mycrate::St{};
}
fn main(){} Same stacktrace and very similar mcve as #140906 , so the two are probably duplicates. (Although this one curiously requires @rustbot label: -E-needs-mcve +S-has-mcve +requires-incomplete-features |
azhogin
added a commit
to azhogin/rust
that referenced
this issue
May 15, 2025
Fix: #141031 |
azhogin
added a commit
to azhogin/rust
that referenced
this issue
May 15, 2025
hkBst
added a commit
to hkBst/rust
that referenced
this issue
May 16, 2025
…ncy-fix, r=oli-obk Async drop fix for dropee from another crate (rust-lang#140858) Fixes rust-lang#140858. For `AsyncDestructor` impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate. Also, potential problem found: when user crate drops type with async drop in dependency crate, and user crate doesn't enable `feature(async_drop)`, then sync drop version will be used. Is it a problem? Do we need some notification about such situations?
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 17, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#140208 (Make well-formedness predicates no longer coinductive) - rust-lang#140957 (Add `#[must_use]` to Array::map) - rust-lang#141031 (Async drop fix for dropee from another crate (rust-lang#140858)) - rust-lang#141036 (ci: split the dist-ohos job) - rust-lang#141051 (Remove some unnecessary erases) - rust-lang#141056 (Lowercase git url for rust-lang/enzyme.git) - rust-lang#141059 (HIR: explain in comment why `ExprKind::If` "then" is an `Expr`) - rust-lang#141070 (Do not emit help when shorthand from macro when suggest `?` or `expect`) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 17, 2025
Rollup merge of rust-lang#141031 - azhogin:azhogin/async-drop-dependency-fix, r=oli-obk Async drop fix for dropee from another crate (rust-lang#140858) Fixes rust-lang#140858. For `AsyncDestructor` impl def id was wrongly kept as a LocalDefId, which causes crash when dropee is declared in another crate. Also, potential problem found: when user crate drops type with async drop in dependency crate, and user crate doesn't enable `feature(async_drop)`, then sync drop version will be used. Is it a problem? Do we need some notification about such situations?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
F-async_drop
`#![feature(async_drop)]`
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
requires-incomplete-features
This issue requires the use of incomplete features.
S-has-mcve
Status: A Minimal Complete and Verifiable Example has been found for this issue
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
the lib.rs https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e3445d1d48c59d1535129148ff8ff681
the main.rs https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=71b08ed816421d78b89b213eaedba212
the
user_stack
crate is a local project and not yet open source, but it enabled theasync_drop
nightly feature by add dep in Cargo.tomlMeta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: