summaryrefslogtreecommitdiffstats
path: root/vendor/futures-task/src/waker_ref.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/futures-task/src/waker_ref.rs
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/futures-task/src/waker_ref.rs')
-rw-r--r--vendor/futures-task/src/waker_ref.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/vendor/futures-task/src/waker_ref.rs b/vendor/futures-task/src/waker_ref.rs
index 791c69012..aac410957 100644
--- a/vendor/futures-task/src/waker_ref.rs
+++ b/vendor/futures-task/src/waker_ref.rs
@@ -18,6 +18,7 @@ pub struct WakerRef<'a> {
impl<'a> WakerRef<'a> {
/// Create a new [`WakerRef`] from a [`Waker`] reference.
+ #[inline]
pub fn new(waker: &'a Waker) -> Self {
// copy the underlying (raw) waker without calling a clone,
// as we won't call Waker::drop either.
@@ -31,6 +32,7 @@ impl<'a> WakerRef<'a> {
/// an unsafe way (that will be valid only for a lifetime to be determined
/// by the caller), and the [`Waker`] doesn't need to or must not be
/// destroyed.
+ #[inline]
pub fn new_unowned(waker: ManuallyDrop<Waker>) -> Self {
Self { waker, _marker: PhantomData }
}
@@ -39,6 +41,7 @@ impl<'a> WakerRef<'a> {
impl Deref for WakerRef<'_> {
type Target = Waker;
+ #[inline]
fn deref(&self) -> &Waker {
&self.waker
}
@@ -55,7 +58,7 @@ where
{
// simply copy the pointer instead of using Arc::into_raw,
// as we don't actually keep a refcount by using ManuallyDrop.<
- let ptr = (&**wake as *const W) as *const ();
+ let ptr = Arc::as_ptr(wake).cast::<()>();
let waker =
ManuallyDrop::new(unsafe { Waker::from_raw(RawWaker::new(ptr, waker_vtable::<W>())) });