AsyncDestructor: replace fields with impl_did#139348
Merged
bors merged 1 commit intorust-lang:masterfrom Apr 5, 2025
Merged
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.
Collaborator
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
Contributor
Author
Contributor
|
cc @zetanumbers |
Contributor
Although I should notice such an error easily, could you please provide failing code sample? Adding a test case would be the best. |
Contributor
Author
|
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<()>;
}
|
Contributor
|
Holy! Now I remember. Thanks for fixing it. LGTM @petrochenkov |
zetanumbers
approved these changes
Apr 4, 2025
Contributor
|
r? @petrochenkov |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 4, 2025
…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
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 5, 2025
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.