Skip to content

Tracking Issue for {Mutex, RwLock}::data_ptr #140368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks
jplatte opened this issue Apr 27, 2025 · 0 comments
Open
3 tasks

Tracking Issue for {Mutex, RwLock}::data_ptr #140368

jplatte opened this issue Apr 27, 2025 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-unimplemented Status: The feature has not been implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@jplatte
Copy link
Contributor

jplatte commented Apr 27, 2025

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<T> {
    pub fn data_ptr(&self) -> *mut T;
}

impl<T: ?Sized> RwLock<T> {
    pub fn data_ptr(&self) -> *mut T;
}

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

  • Implementation: #...
  • 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 return NonNull<T>?

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@jplatte jplatte added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-unimplemented Status: The feature has not been implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC S-tracking-unimplemented Status: The feature has not been implemented. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant