compiler/rustc_data_structures/src/sync.rs: these RwLock methods are never called, so let's remove them
This commit is contained in:
parent
6171d944ae
commit
42ceb25679
1 changed files with 0 additions and 20 deletions
|
@ -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)]
|
#[inline(always)]
|
||||||
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
|
pub fn try_write(&self) -> Result<WriteGuard<'_, T>, ()> {
|
||||||
self.0.try_write().ok_or(())
|
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)]
|
#[inline(always)]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn borrow(&self) -> ReadGuard<'_, T> {
|
pub fn borrow(&self) -> ReadGuard<'_, T> {
|
||||||
|
@ -240,14 +228,6 @@ impl<T> RwLock<T> {
|
||||||
pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
|
pub fn borrow_mut(&self) -> WriteGuard<'_, T> {
|
||||||
self.write()
|
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
|
// FIXME: Probably a bad idea
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue