Feature gate: #![feature(mutex_data_ptr)], #![feature(rwlock_data_ptr)], #![feature(reentrant_lock_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<T> {
pub fn data_ptr(&self) -> *mut T;
}
impl<T: ?Sized> RwLock<T> {
pub fn data_ptr(&self) -> *mut T;
}
// This type is unstable under feature `reentrant_lock`
impl<T: ?Sized> ReentrantLock<T> {
pub fn data_ptr(&self) -> *mut T;
}
Steps / History
(Remember to update the S-tracking-* label when checking boxes.)
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 return NonNull<T>?
Feature gate:
#![feature(mutex_data_ptr)],#![feature(rwlock_data_ptr)], #![feature(reentrant_lock_data_ptr)]This is a tracking issue for allowing unguarded access to the inner value of a
MutexorRwLock. Previous discussion here: rust-lang/libs-team#531Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)Unresolved Questions
LockResultor not?*mut Tlike existing APIs (Cell::as_ptr/MaybeUninit::as[_mut]_ptr/Vec::as_ptr/ ...) or be more precise and returnNonNull<T>?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩