-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
AsyncDestructor: replace fields with impl_did #139348
Conversation
The future and ctor fields aren't actually used, and the way they are extracted is obviously wrong – swapping the order of the items in the source code will give wrong results. Instead, store just the LocalDefId of the impl, which is enough for the only use of this data.
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
cc @zetanumbers |
Although I should notice such an error easily, could you please provide failing code sample? Adding a test case would be the best. |
There is no failing sample, because you never use these fields for anything. However:
#![feature(async_drop)]
use std::future::{AsyncDrop, Ready};
use std::pin::Pin;
struct Foo;
impl AsyncDrop for Foo {
type Dropper<'a> = Ready<()>;
fn async_drop(self: Pin<&mut Self>) -> Self::Dropper<'_> {
todo!()
}
}
impl AsyncDrop for Foo {
fn async_drop(self: Pin<&mut Self>) -> Self::Dropper<'_> {
todo!()
}
type Dropper<'a> = Ready<()>;
}
|
Holy! Now I remember. Thanks for fixing it. LGTM @petrochenkov |
r? @petrochenkov |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#139041 (Remove `rustc_middle::ty::util::ExplicitSelf`.) - rust-lang#139328 (Fix 2024 edition doctest panic output) - rust-lang#139339 (unstable book: document tait) - rust-lang#139348 (AsyncDestructor: replace fields with impl_did) - rust-lang#139353 (Fix `Debug` impl for `LateParamRegionKind`.) - rust-lang#139366 (ToSocketAddrs: fix typo) - rust-lang#139374 (Use the span of the whole bound when the diagnostic talks about a bound) - rust-lang#139378 (Use target-agnostic LLD flags in bootstrap for `use-lld`) - rust-lang#139384 (Add `compiletest` adhoc_group for `r? compiletest`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#139348 - meithecatte:async-destructor-minify, r=petrochenkov AsyncDestructor: replace fields with impl_did The future and ctor fields aren't actually used, and the way they are extracted is obviously wrong – swapping the order of the items in the source code will give wrong results. Instead, store just the LocalDefId of the impl, which is enough for the only use of this data.
The future and ctor fields aren't actually used, and the way they are extracted is obviously wrong – swapping the order of the items in the source code will give wrong results.
Instead, store just the LocalDefId of the impl, which is enough for the only use of this data.