diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index e56b631dbaf8..c0121eebb7fe 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -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>, diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 265ba9f1bb91..2230461b5f4b 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -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)] diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs index 9abd4b547c77..06a97fd3f761 100644 --- a/library/std/src/sync/mutex.rs +++ b/library/std/src/sync/mutex.rs @@ -192,7 +192,7 @@ unsafe impl Sync for Mutex {} 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> { diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index 1523d36323fd..aa1ce82d9679 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -99,7 +99,7 @@ unsafe impl Sync for RwLock {} 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> { diff --git a/src/test/ui/lint/must_not_suspend/mutex.stderr b/src/test/ui/lint/must_not_suspend/mutex.stderr index 47a84fdbc573..4e0d9343c2c7 100644 --- a/src/test/ui/lint/must_not_suspend/mutex.stderr +++ b/src/test/ui/lint/must_not_suspend/mutex.stderr @@ -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();