compiler/rustc_data_structures/src/sync.rs: these RwLock methods are never called, so let's remove them

This commit is contained in:
Askar Safin 2025-02-08 11:55:41 +03:00
parent 6171d944ae
commit 42ceb25679

View file

@ -203,12 +203,6 @@ impl<T> RwLock<T> {
}
}
#[inline(always)]
#[track_caller]
pub fn with_read_lock<F: FnOnce(&T) -> R, R>(&self, f: F) -> R {
f(&*self.read())
}
#[inline(always)]
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
self.0.try_write().ok_or(())
@ -223,12 +217,6 @@ impl<T> RwLock<T> {
}
}
#[inline(always)]
#[track_caller]
pub fn with_write_lock<F: FnOnce(&mut T) -> R, R>(&self, f: F) -> R {
f(&mut *self.write())
}
#[inline(always)]
#[track_caller]
pub fn borrow(&self) -> ReadGuard<'_, T> {
@ -240,14 +228,6 @@ impl<T> RwLock<T> {
pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
self.write()
}
#[inline(always)]
pub fn leak(&self) -> &T {
let guard = self.read();
let ret = unsafe { &*(&raw const *guard) };
std::mem::forget(guard);
ret
}
}
// FIXME: Probably a bad idea