We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c979189 commit 962a53dCopy full SHA for 962a53d
src/librustc_data_structures/sync.rs
@@ -388,6 +388,18 @@ impl<T> RwLock<T> {
388
f(&*self.read())
389
}
390
391
+ #[cfg(not(parallel_queries))]
392
+ #[inline(always)]
393
+ pub fn try_write(&self) -> Result<WriteGuard<T>, ()> {
394
+ self.0.try_borrow_mut().map_err(|_| ())
395
+ }
396
+
397
+ #[cfg(parallel_queries)]
398
399
400
+ self.0.try_write().ok_or(())
401
402
403
#[cfg(not(parallel_queries))]
404
#[inline(always)]
405
pub fn write(&self) -> WriteGuard<T> {
0 commit comments