Skip to content

Commit 2933384

Browse files
committed
compiler/rustc_data_structures/src/sync.rs: these RwLock methods are never called, so let's remove them
1 parent 124cc92 commit 2933384

File tree

1 file changed

+0
-20
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+0
-20
lines changed

compiler/rustc_data_structures/src/sync.rs

-20
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ impl<T> RwLock<T> {
203203
}
204204
}
205205

206-
#[inline(always)]
207-
#[track_caller]
208-
pub fn with_read_lock<F: FnOnce(&T) -> R, R>(&self, f: F) -> R {
209-
f(&*self.read())
210-
}
211-
212206
#[inline(always)]
213207
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
214208
self.0.try_write().ok_or(())
@@ -223,12 +217,6 @@ impl<T> RwLock<T> {
223217
}
224218
}
225219

226-
#[inline(always)]
227-
#[track_caller]
228-
pub fn with_write_lock<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> R {
229-
f(&mut *self.write())
230-
}
231-
232220
#[inline(always)]
233221
#[track_caller]
234222
pub fn borrow(&self) -> ReadGuard<'_, T> {
@@ -240,14 +228,6 @@ impl<T> RwLock<T> {
240228
pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
241229
self.write()
242230
}
243-
244-
#[inline(always)]
245-
pub fn leak(&self) -> &T {
246-
let guard = self.read();
247-
let ret = unsafe { &*(&raw const *guard) };
248-
std::mem::forget(guard);
249-
ret
250-
}
251231
}
252232

253233
// FIXME: Probably a bad idea

0 commit comments

Comments
 (0)