File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
library/std/src/sync/poison Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -610,6 +610,11 @@ impl<T: ?Sized> Mutex<T> {
610610 }
611611
612612 /// Returns a raw pointer to the underlying data.
613+ ///
614+ /// The returned pointer is always non-null and properly aligned, but it is
615+ /// the user's responsibility to ensure that any reads and writes through it
616+ /// are properly synchronized to avoid data races, and that it is not read
617+ /// or written through after the mutex is dropped.
613618 #[ unstable( feature = "mutex_data_ptr" , issue = "140368" ) ]
614619 pub fn data_ptr ( & self ) -> * mut T {
615620 self . data . get ( )
Original file line number Diff line number Diff line change @@ -636,6 +636,11 @@ impl<T: ?Sized> RwLock<T> {
636636 }
637637
638638 /// Returns a raw pointer to the underlying data.
639+ ///
640+ /// The returned pointer is always non-null and properly aligned, but it is
641+ /// the user's responsibility to ensure that any reads and writes through it
642+ /// are properly synchronized to avoid data races, and that it is not read
643+ /// or written through after the lock is dropped.
639644 #[ unstable( feature = "rwlock_data_ptr" , issue = "140368" ) ]
640645 pub fn data_ptr ( & self ) -> * mut T {
641646 self . data . get ( )
You can’t perform that action at this time.
0 commit comments