Skip to content

Commit

Permalink
Rollup merge of rust-lang#87507 - jethrogb:jb/sgx-unmoveable-mutex, r…
Browse files Browse the repository at this point in the history
…=dtolnay

SGX mutex is *not* moveable

Reverts the erroneous change in rust-lang#85029.
  • Loading branch information
JohnTitor committed Jul 28, 2021
2 parents 3a423cc + b518dc7 commit 7987e0f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/std/src/sys/sgx/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ pub struct Mutex {
inner: SpinMutex<WaitVariable<bool>>,
}

pub type MovableMutex = Mutex;
// not movable: see UnsafeList implementation
pub type MovableMutex = Box<Mutex>;

// Implementation according to “Operating Systems: Three Easy Pieces”, chapter 28
impl Mutex {
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/sgx/waitqueue/unsafe_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl<T> UnsafeListEntry<T> {
}
}

// WARNING: self-referential struct!
pub struct UnsafeList<T> {
head_tail: NonNull<UnsafeListEntry<T>>,
head_tail_entry: Option<UnsafeListEntry<T>>,
Expand Down

0 comments on commit 7987e0f

Please sign in to comment.