Skip to content

Commit 732ef10

Browse files
committed
Make code compile
1 parent 499a44a commit 732ef10

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/sync/mutex.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ impl<T: ?Sized> Mutex<T> {
9393
/// # })
9494
/// ```
9595
pub async fn lock(&self) -> MutexGuard<'_, T> {
96-
pub struct LockFuture<'a, T> {
96+
pub struct LockFuture<'a, T: ?Sized> {
9797
mutex: &'a Mutex<T>,
9898
opt_key: Option<usize>,
9999
}
100100

101-
impl<'a, T> Future for LockFuture<'a, T> {
101+
impl<'a, T: ?Sized> Future for LockFuture<'a, T> {
102102
type Output = MutexGuard<'a, T>;
103103

104104
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@@ -125,7 +125,7 @@ impl<T: ?Sized> Mutex<T> {
125125
}
126126
}
127127

128-
impl<T> Drop for LockFuture<'_, T> {
128+
impl<T: ?Sized> Drop for LockFuture<'_, T> {
129129
fn drop(&mut self) {
130130
// If the current task is still in the set, that means it is being cancelled now.
131131
if let Some(key) = self.opt_key {

src/sync/rwlock.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ impl<T: ?Sized> RwLock<T> {
101101
/// # })
102102
/// ```
103103
pub async fn read(&self) -> RwLockReadGuard<'_, T> {
104-
pub struct ReadFuture<'a, T> {
104+
pub struct ReadFuture<'a, T: ?Sized> {
105105
lock: &'a RwLock<T>,
106106
opt_key: Option<usize>,
107107
}
108108

109-
impl<'a, T> Future for ReadFuture<'a, T> {
109+
impl<'a, T: ?Sized> Future for ReadFuture<'a, T> {
110110
type Output = RwLockReadGuard<'a, T>;
111111

112112
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@@ -133,7 +133,7 @@ impl<T: ?Sized> RwLock<T> {
133133
}
134134
}
135135

136-
impl<T> Drop for ReadFuture<'_, T> {
136+
impl<T: ?Sized> Drop for ReadFuture<'_, T> {
137137
fn drop(&mut self) {
138138
// If the current task is still in the set, that means it is being cancelled now.
139139
if let Some(key) = self.opt_key {
@@ -226,12 +226,12 @@ impl<T: ?Sized> RwLock<T> {
226226
/// # })
227227
/// ```
228228
pub async fn write(&self) -> RwLockWriteGuard<'_, T> {
229-
pub struct WriteFuture<'a, T> {
229+
pub struct WriteFuture<'a, T: ?Sized> {
230230
lock: &'a RwLock<T>,
231231
opt_key: Option<usize>,
232232
}
233233

234-
impl<'a, T> Future for WriteFuture<'a, T> {
234+
impl<'a, T: ?Sized> Future for WriteFuture<'a, T> {
235235
type Output = RwLockWriteGuard<'a, T>;
236236

237237
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@@ -258,7 +258,7 @@ impl<T: ?Sized> RwLock<T> {
258258
}
259259
}
260260

261-
impl<T> Drop for WriteFuture<'_, T> {
261+
impl<T: ?Sized> Drop for WriteFuture<'_, T> {
262262
fn drop(&mut self) {
263263
// If the current task is still in the set, that means it is being cancelled now.
264264
if let Some(key) = self.opt_key {

0 commit comments

Comments
 (0)