-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Feature: Provide getters of data and vtable pointer for RawWaker? #87021
Copy link
Copy link
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Docs of
std::task::RawWaker:We said it consists of two pointer, but doesn't enforce its layout by
repr, nor provide methods to get data and vtable pointer from a constructedRawWaker. So it impossible to destruct aRawWakereven withtransmute, since the layout is unknown, which makdes it difficult to passRawWakerorWakeracross FFI boundary.Note that
Wakerhasrepr(transparent)on it so it's able totransmuteinto aRawWaker. But it barely does anything since we can do nothing with aRawWaker. I'm confusing about why there is arepr(transparent)struct to an blackbox struct without any methods.If it's intended to NOT stabilizing the layout of
std::task::RawWaker. I think we should at least provide methods likefn data(&self) -> *mut ()andfn vtable(&self) -> &'static RawWakerVTableto do the inverse ofRawWaker::new, which can be used to destruct it to cross FFI boundary.