Tracking Issue for {Mutex, RwLock}::data_ptr · Issue #140368 · rust-lang/rust (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Feature gate: #![feature(mutex_data_ptr)]
, #![feature(rwlock_data_ptr)]
This is a tracking issue for allowing unguarded access to the inner value of a Mutex
or RwLock
. Previous discussion here: rust-lang/libs-team#531
Public API
// std::sync
impl<T: ?Sized> Mutex { pub fn data_ptr(&self) -> *mut T; }
impl<T: ?Sized> RwLock { pub fn data_ptr(&self) -> *mut T; }
Steps / History
(Remember to update the S-tracking-*
label when checking boxes.)
- Implementation: Add data_ptr method to Mutex and RwLock #140369
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Return a
LockResult
or not? - Return
*mut T
like existing APIs (Cell::as_ptr
/MaybeUninit::as[_mut]_ptr
/Vec::as_ptr
/ ...) or be more precise and returnNonNull<T>
?