From 732ef10f9812e1581132af5e077a7b27de414dd2 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sat, 14 Dec 2019 23:42:14 +0800 Subject: [PATCH] Make code compile --- src/sync/mutex.rs | 6 +++--- src/sync/rwlock.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/sync/mutex.rs b/src/sync/mutex.rs index 3782bb63..c62b5616 100644 --- a/src/sync/mutex.rs +++ b/src/sync/mutex.rs @@ -93,12 +93,12 @@ impl Mutex { /// # }) /// ``` pub async fn lock(&self) -> MutexGuard<'_, T> { - pub struct LockFuture<'a, T> { + pub struct LockFuture<'a, T: ?Sized> { mutex: &'a Mutex, opt_key: Option, } - impl<'a, T> Future for LockFuture<'a, T> { + impl<'a, T: ?Sized> Future for LockFuture<'a, T> { type Output = MutexGuard<'a, T>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -125,7 +125,7 @@ impl Mutex { } } - impl Drop for LockFuture<'_, T> { + impl Drop for LockFuture<'_, T> { fn drop(&mut self) { // If the current task is still in the set, that means it is being cancelled now. if let Some(key) = self.opt_key { diff --git a/src/sync/rwlock.rs b/src/sync/rwlock.rs index a748607f..08d8ed84 100644 --- a/src/sync/rwlock.rs +++ b/src/sync/rwlock.rs @@ -101,12 +101,12 @@ impl RwLock { /// # }) /// ``` pub async fn read(&self) -> RwLockReadGuard<'_, T> { - pub struct ReadFuture<'a, T> { + pub struct ReadFuture<'a, T: ?Sized> { lock: &'a RwLock, opt_key: Option, } - impl<'a, T> Future for ReadFuture<'a, T> { + impl<'a, T: ?Sized> Future for ReadFuture<'a, T> { type Output = RwLockReadGuard<'a, T>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -133,7 +133,7 @@ impl RwLock { } } - impl Drop for ReadFuture<'_, T> { + impl Drop for ReadFuture<'_, T> { fn drop(&mut self) { // If the current task is still in the set, that means it is being cancelled now. if let Some(key) = self.opt_key { @@ -226,12 +226,12 @@ impl RwLock { /// # }) /// ``` pub async fn write(&self) -> RwLockWriteGuard<'_, T> { - pub struct WriteFuture<'a, T> { + pub struct WriteFuture<'a, T: ?Sized> { lock: &'a RwLock, opt_key: Option, } - impl<'a, T> Future for WriteFuture<'a, T> { + impl<'a, T: ?Sized> Future for WriteFuture<'a, T> { type Output = RwLockWriteGuard<'a, T>; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { @@ -258,7 +258,7 @@ impl RwLock { } } - impl Drop for WriteFuture<'_, T> { + impl Drop for WriteFuture<'_, T> { fn drop(&mut self) { // If the current task is still in the set, that means it is being cancelled now. if let Some(key) = self.opt_key {