Skip to content

Commit cb8e83c

Browse files
committed
ref/refmut
1 parent 4cc3297 commit cb8e83c

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

library/core/src/cell.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,11 @@ impl Clone for BorrowRef<'_> {
13031303
///
13041304
/// See the [module-level documentation](self) for more.
13051305
#[stable(feature = "rust1", since = "1.0.0")]
1306+
#[cfg_attr(
1307+
not(bootstrap),
1308+
must_not_suspend = "Holding a Ref across suspend \
1309+
points can cause BorrowErrors"
1310+
)]
13061311
pub struct Ref<'b, T: ?Sized + 'b> {
13071312
value: &'b T,
13081313
borrow: BorrowRef<'b>,
@@ -1679,6 +1684,11 @@ impl<'b> BorrowRefMut<'b> {
16791684
///
16801685
/// See the [module-level documentation](self) for more.
16811686
#[stable(feature = "rust1", since = "1.0.0")]
1687+
#[cfg_attr(
1688+
not(bootstrap),
1689+
must_not_suspend = "Holding a RefMut across suspend \
1690+
points can cause BorrowErrors"
1691+
)]
16821692
pub struct RefMut<'b, T: ?Sized + 'b> {
16831693
value: &'b mut T,
16841694
borrow: BorrowRefMut<'b>,

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
#![feature(link_llvm_intrinsics)]
142142
#![feature(llvm_asm)]
143143
#![feature(min_specialization)]
144+
#![cfg_attr(not(bootstrap), feature(must_not_suspend))]
144145
#![feature(negative_impls)]
145146
#![feature(never_type)]
146147
#![feature(no_core)]

library/std/src/sync/mutex.rs

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

library/std/src/sync/rwlock.rs

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

src/test/ui/lint/must_not_suspend/mutex.stderr

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

0 commit comments

Comments
 (0)