1
Fork 0

ref/refmut

This commit is contained in:
Gus Wynn 2021-09-28 17:57:08 -07:00
parent 4cc3297dc4
commit cb8e83caeb
5 changed files with 14 additions and 3 deletions

View file

@ -1303,6 +1303,11 @@ impl Clone for BorrowRef<'_> {
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
must_not_suspend = "Holding a Ref across suspend \
points can cause BorrowErrors"
)]
pub struct Ref<'b, T: ?Sized + 'b> {
value: &'b T,
borrow: BorrowRef<'b>,
@ -1679,6 +1684,11 @@ impl<'b> BorrowRefMut<'b> {
///
/// See the [module-level documentation](self) for more.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(
not(bootstrap),
must_not_suspend = "Holding a RefMut across suspend \
points can cause BorrowErrors"
)]
pub struct RefMut<'b, T: ?Sized + 'b> {
value: &'b mut T,
borrow: BorrowRefMut<'b>,

View file

@ -141,6 +141,7 @@
#![feature(link_llvm_intrinsics)]
#![feature(llvm_asm)]
#![feature(min_specialization)]
#![cfg_attr(not(bootstrap), feature(must_not_suspend))]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(no_core)]

View file

@ -192,7 +192,7 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> {}
not(bootstrap),
must_not_suspend = "Holding a MutexGuard across suspend \
points can cause deadlocks, delays, \
and cause Future's to not implement `Send`"
and cause Futures to not implement `Send`"
)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct MutexGuard<'a, T: ?Sized + 'a> {

View file

@ -99,7 +99,7 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
not(bootstrap),
must_not_suspend = "Holding a RwLockReadGuard across suspend \
points can cause deadlocks, delays, \
and cause Future's to not implement `Send`"
and cause Futures to not implement `Send`"
)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {

View file

@ -11,7 +11,7 @@ note: the lint level is defined here
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
note: Holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Future's to not implement `Send`
note: Holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Futures to not implement `Send`
--> $DIR/mutex.rs:7:9
|
LL | let _guard = m.lock().unwrap();