diff options
| author | Jonas Platte <jplatte+git@posteo.de> | 2025-05-21 08:05:44 +0200 |
|---|---|---|
| committer | Jonas Platte <jplatte+git@posteo.de> | 2025-05-21 08:07:43 +0200 |
| commit | 9d6c5a88a18405eb53e91645d35371ab089f0a37 (patch) | |
| tree | b8c276d3f8b43150a476426bb61e7dd7b73401ce | |
| parent | 9efad3a87bb69ce62f9a5b1703e1b8decfe5c4a6 (diff) | |
| download | rust-9d6c5a88a18405eb53e91645d35371ab089f0a37.tar.gz rust-9d6c5a88a18405eb53e91645d35371ab089f0a37.zip | |
Add more docs to new data_ptr methods
| -rw-r--r-- | library/std/src/sync/poison/mutex.rs | 5 | ||||
| -rw-r--r-- | library/std/src/sync/poison/rwlock.rs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/library/std/src/sync/poison/mutex.rs b/library/std/src/sync/poison/mutex.rs index 372bf0a3029..30325be685c 100644 --- a/library/std/src/sync/poison/mutex.rs +++ b/library/std/src/sync/poison/mutex.rs @@ -610,6 +610,11 @@ impl<T: ?Sized> Mutex<T> { } /// Returns a raw pointer to the underlying data. + /// + /// The returned pointer is always non-null and properly aligned, but it is + /// the user's responsibility to ensure that any reads and writes through it + /// are properly synchronized to avoid data races, and that it is not read + /// or written through after the mutex is dropped. #[unstable(feature = "mutex_data_ptr", issue = "140368")] pub fn data_ptr(&self) -> *mut T { self.data.get() diff --git a/library/std/src/sync/poison/rwlock.rs b/library/std/src/sync/poison/rwlock.rs index 0b32a2f1be1..a060e2ea57a 100644 --- a/library/std/src/sync/poison/rwlock.rs +++ b/library/std/src/sync/poison/rwlock.rs @@ -636,6 +636,11 @@ impl<T: ?Sized> RwLock<T> { } /// Returns a raw pointer to the underlying data. + /// + /// The returned pointer is always non-null and properly aligned, but it is + /// the user's responsibility to ensure that any reads and writes through it + /// are properly synchronized to avoid data races, and that it is not read + /// or written through after the lock is dropped. #[unstable(feature = "rwlock_data_ptr", issue = "140368")] pub fn data_ptr(&self) -> *mut T { self.data.get() |
