Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #117107 - zachs18:mapped-mutex-guard, r=Amanieu
Implement `MappedMutexGuard`, `MappedRwLockReadGuard`, and `MappedRwLockWriteGuard`. ACP: rust-lang/libs-team#260 Tracking issue: rust-lang/rust#117108 <details> <summary> (Outdated) </summary> `MutexState`/`RwLockState` structs ~~Having `sys::(Mutex|RwLock)` and `poison::Flag` as separate fields in the `Mutex`/`RwLock` would require `MappedMutexGuard`/`MappedRwLockWriteGuard` to hold an additional pointer, so I combined the two fields into a `MutexState`/`RwLockState` struct. This should not noticeably affect perf or layout, but requires an additional field projection when accessing the former `.inner` or `.poison` fields (now `.state.inner` and `.state.poison`).~~ If this is not desired, then `MappedMutexGuard`/`MappedRwLockWriteGuard` can instead hold separate pointers to the two fields. </details> The doc-comments are mostly copied from the existing `*Guard` doc-comments, with some parts from `lock_api::Mapped*Guard`'s doc-comments. Unresolved question: Are more tests needed?
- Loading branch information