rust/library
Mara Bos 6f6336b4a1 Split sys_common::Mutex in StaticMutex and MovableMutex.
The (unsafe) Mutex from sys_common had a rather complicated interface.
You were supposed to call init() manually, unless you could guarantee it
was neither moved nor used reentrantly.

Calling `destroy()` was also optional, although it was unclear if 1)
resources might be leaked or not, and 2) if destroy() should only be
called when `init()` was called.

This allowed for a number of interesting (confusing?) different ways to
use this Mutex, all captured in a single type.

In practice, this type was only ever used in two ways:

1. As a static variable. In this case, neither init() nor destroy() are
   called. The variable is never moved, and it is never used
   reentrantly. It is only ever locked using the LockGuard, never with
   raw_lock.

2. As a Boxed variable. In this case, both init() and destroy() are
   called, it will be moved and possibly used reentrantly.

No other combinations are used anywhere in `std`.

This change simplifies things by splitting this Mutex type into
two types matching the two use cases: StaticMutex and MovableMutex.

The interface of both new types is now both safer and simpler. The first
one does not call nor expose init/destroy, and the second one calls
those automatically in its new() and Drop functions. Also, the locking
functions of MovableMutex are no longer unsafe.
2020-09-27 10:05:56 +02:00
..
alloc Rollup merge of #77184 - pickfire:patch-4, r=kennytm 2020-09-27 01:53:22 +02:00
backtrace@4083a90168
core Rollup merge of #77167 - fusion-engineering-forks:fix-fixme-min-max-sign-test, r=nagisa 2020-09-27 01:53:20 +02:00
panic_abort Rollup merge of #76866 - est31:master, r=lcnr 2020-09-20 15:51:50 +02:00
panic_unwind Rollup merge of #76973 - lzutao:unstably-const-assume, r=oli-obk 2020-09-25 19:42:29 +02:00
proc_macro Update library functions with stability attributes 2020-09-22 10:05:58 -07:00
profiler_builtins
rtstartup
rustc-std-workspace-alloc
rustc-std-workspace-core
rustc-std-workspace-std
std Split sys_common::Mutex in StaticMutex and MovableMutex. 2020-09-27 10:05:56 +02:00
stdarch@718175b34a Update stdarch 2020-09-15 17:26:20 +02:00
term
test Rollup merge of #77009 - est31:dogfood_total_cmp, r=lcnr 2020-09-21 15:30:49 +02:00
unwind library/unwind: Add missing ) 2020-09-17 07:10:10 -07:00