Skip to content

Commit a92b5cc

Browse files
committed
Remove references to StaticMutex which got removed a while ago
1 parent 7c98d2e commit a92b5cc

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/librustc_mir/diagnostics.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,7 @@ const F: &'static C = &D; // error
12811281
```
12821282
12831283
This is because cell types do operations that are not thread-safe. Due to this,
1284-
they don't implement Sync and thus can't be placed in statics. In this
1285-
case, `StaticMutex` would work just fine, but it isn't stable yet:
1286-
https://doc.rust-lang.org/nightly/std/sync/struct.StaticMutex.html
1284+
they don't implement Sync and thus can't be placed in statics.
12871285
12881286
However, if you still wish to use these types, you can achieve this by an unsafe
12891287
wrapper:

src/libstd/sync/once.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@
3131
// initialization closure panics, the Once enters a "poisoned" state which means
3232
// that all future calls will immediately panic as well.
3333
//
34-
// So to implement this, one might first reach for a `StaticMutex`, but those
35-
// unfortunately need to be deallocated (e.g. call `destroy()`) to free memory
36-
// on all OSes (some of the BSDs allocate memory for mutexes). It also gets a
37-
// lot harder with poisoning to figure out when the mutex needs to be
38-
// deallocated because it's not after the closure finishes, but after the first
39-
// successful closure finishes.
34+
// So to implement this, one might first reach for a `Mutex`, but those cannot
35+
// be put into a `static`. It also gets a lot harder with poisoning to figure
36+
// out when the mutex needs to be deallocated because it's not after the closure
37+
// finishes, but after the first successful closure finishes.
4038
//
4139
// All in all, this is instead implemented with atomics and lock-free
4240
// operations! Whee! Each `Once` has one word of atomic state, and this state is

src/libstd/sys/unix/mutex.rs

-3
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ impl Mutex {
4949
// references, we instead create the mutex with type
5050
// PTHREAD_MUTEX_NORMAL which is guaranteed to deadlock if we try to
5151
// re-lock it from the same thread, thus avoiding undefined behavior.
52-
//
53-
// We can't do anything for StaticMutex, but that type is deprecated
54-
// anyways.
5552
let mut attr: libc::pthread_mutexattr_t = mem::uninitialized();
5653
let r = libc::pthread_mutexattr_init(&mut attr);
5754
debug_assert_eq!(r, 0);

0 commit comments

Comments
 (0)