diff options
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/collections/hash/map.rs | 10 | ||||
| -rw-r--r-- | library/std/src/sys/sgx/mutex.rs | 3 | ||||
| -rw-r--r-- | library/std/src/sys/sgx/waitqueue/unsafe_list.rs | 1 |
3 files changed, 4 insertions, 10 deletions
diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index b102fd9d5bf..933d686521e 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -2821,15 +2821,7 @@ where #[inline] fn extend_reserve(&mut self, additional: usize) { - // self.base.extend_reserve(additional); - // FIXME: hashbrown should implement this method. - // But until then, use the same reservation logic: - - // Reserve the entire hint lower bound if the map is empty. - // Otherwise reserve half the hint (rounded up), so the map - // will only resize twice in the worst case. - let reserve = if self.is_empty() { additional } else { (additional + 1) / 2 }; - self.base.reserve(reserve); + self.base.extend_reserve(additional); } } diff --git a/library/std/src/sys/sgx/mutex.rs b/library/std/src/sys/sgx/mutex.rs index 1b5ced4178f..0b2d1f4487f 100644 --- a/library/std/src/sys/sgx/mutex.rs +++ b/library/std/src/sys/sgx/mutex.rs @@ -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 { diff --git a/library/std/src/sys/sgx/waitqueue/unsafe_list.rs b/library/std/src/sys/sgx/waitqueue/unsafe_list.rs index cf2f0886c15..c736cab576e 100644 --- a/library/std/src/sys/sgx/waitqueue/unsafe_list.rs +++ b/library/std/src/sys/sgx/waitqueue/unsafe_list.rs @@ -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>>, |
