about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-07 16:24:46 +0000
committerbors <bors@rust-lang.org>2021-05-07 16:24:46 +0000
commitca712bc4255cd0912e00ec2eee5b6a547385c2b0 (patch)
treeff4d9ea888df4811d26c260f8bd532d901c016df /library/std
parente5f83d24aee866a14753a7cedbb4e301dfe5bef5 (diff)
parent42848090b588a53bc31cfe3718090f488a69633e (diff)
downloadrust-ca712bc4255cd0912e00ec2eee5b6a547385c2b0.tar.gz
rust-ca712bc4255cd0912e00ec2eee5b6a547385c2b0.zip
Auto merge of #85036 - Dylan-DPC:rollup-4qfabo3, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #84254 (illumos should put libc last in library search order)
 - #84442 (Unify rustc and rustdoc parsing of `cfg()`)
 - #84655 (Cleanup of `wasm`)
 - #84866 (linker: Avoid library duplication with `/WHOLEARCHIVE`)
 - #84930 (rename LLVM target for RustyHermit)
 - #84991 (rustc: Support Rust-specific features in -Ctarget-feature)
 - #85029 (SGX mutex is movable)
 - #85030 (Rearrange SGX split module files)
 - #85033 (some further small cleanups)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/sys/sgx/abi/tls/mod.rs (renamed from library/std/src/sys/sgx/abi/tls.rs)0
-rw-r--r--library/std/src/sys/sgx/mutex.rs2
-rw-r--r--library/std/src/sys/sgx/waitqueue/mod.rs (renamed from library/std/src/sys/sgx/waitqueue.rs)7
-rw-r--r--library/std/src/sys/sgx/waitqueue/spin_mutex.rs3
-rw-r--r--library/std/src/sys/sgx/waitqueue/unsafe_list.rs3
-rw-r--r--library/std/src/sys/unsupported/args.rs1
-rw-r--r--library/std/src/sys/wasm/args.rs42
-rw-r--r--library/std/src/sys/wasm/atomics/condvar.rs (renamed from library/std/src/sys/wasm/condvar_atomics.rs)0
-rw-r--r--library/std/src/sys/wasm/atomics/futex.rs (renamed from library/std/src/sys/wasm/futex_atomics.rs)0
-rw-r--r--library/std/src/sys/wasm/atomics/mutex.rs (renamed from library/std/src/sys/wasm/mutex_atomics.rs)0
-rw-r--r--library/std/src/sys/wasm/atomics/rwlock.rs (renamed from library/std/src/sys/wasm/rwlock_atomics.rs)0
-rw-r--r--library/std/src/sys/wasm/atomics/thread.rs (renamed from library/std/src/sys/wasm/thread.rs)22
-rw-r--r--library/std/src/sys/wasm/mod.rs14
13 files changed, 22 insertions, 72 deletions
diff --git a/library/std/src/sys/sgx/abi/tls.rs b/library/std/src/sys/sgx/abi/tls/mod.rs
index 13d96e9a633..13d96e9a633 100644
--- a/library/std/src/sys/sgx/abi/tls.rs
+++ b/library/std/src/sys/sgx/abi/tls/mod.rs
diff --git a/library/std/src/sys/sgx/mutex.rs b/library/std/src/sys/sgx/mutex.rs
index 8874517dac6..1b5ced4178f 100644
--- a/library/std/src/sys/sgx/mutex.rs
+++ b/library/std/src/sys/sgx/mutex.rs
@@ -8,7 +8,7 @@ pub struct Mutex {
     inner: SpinMutex<WaitVariable<bool>>,
 }
 
-pub type MovableMutex = Box<Mutex>;
+pub type MovableMutex = Mutex;
 
 // Implementation according to “Operating Systems: Three Easy Pieces”, chapter 28
 impl Mutex {
diff --git a/library/std/src/sys/sgx/waitqueue.rs b/library/std/src/sys/sgx/waitqueue/mod.rs
index e464dc3ee9d..61bb11d9a6f 100644
--- a/library/std/src/sys/sgx/waitqueue.rs
+++ b/library/std/src/sys/sgx/waitqueue/mod.rs
@@ -13,13 +13,8 @@
 #[cfg(test)]
 mod tests;
 
-/// A doubly-linked list where callers are in charge of memory allocation
-/// of the nodes in the list.
-mod unsafe_list;
-
-/// Trivial spinlock-based implementation of `sync::Mutex`.
-// FIXME: Perhaps use Intel TSX to avoid locking?
 mod spin_mutex;
+mod unsafe_list;
 
 use crate::num::NonZeroUsize;
 use crate::ops::{Deref, DerefMut};
diff --git a/library/std/src/sys/sgx/waitqueue/spin_mutex.rs b/library/std/src/sys/sgx/waitqueue/spin_mutex.rs
index 7f1a671bab4..f6e851ccadd 100644
--- a/library/std/src/sys/sgx/waitqueue/spin_mutex.rs
+++ b/library/std/src/sys/sgx/waitqueue/spin_mutex.rs
@@ -1,3 +1,6 @@
+//! Trivial spinlock-based implementation of `sync::Mutex`.
+// FIXME: Perhaps use Intel TSX to avoid locking?
+
 #[cfg(test)]
 mod tests;
 
diff --git a/library/std/src/sys/sgx/waitqueue/unsafe_list.rs b/library/std/src/sys/sgx/waitqueue/unsafe_list.rs
index 0834d2593fc..cf2f0886c15 100644
--- a/library/std/src/sys/sgx/waitqueue/unsafe_list.rs
+++ b/library/std/src/sys/sgx/waitqueue/unsafe_list.rs
@@ -1,3 +1,6 @@
+//! A doubly-linked list where callers are in charge of memory allocation
+//! of the nodes in the list.
+
 #[cfg(test)]
 mod tests;
 
diff --git a/library/std/src/sys/unsupported/args.rs b/library/std/src/sys/unsupported/args.rs
index c924a7d8a26..a2d75a61976 100644
--- a/library/std/src/sys/unsupported/args.rs
+++ b/library/std/src/sys/unsupported/args.rs
@@ -1,4 +1,5 @@
 use crate::ffi::OsString;
+use crate::fmt;
 
 pub struct Args {}
 
diff --git a/library/std/src/sys/wasm/args.rs b/library/std/src/sys/wasm/args.rs
deleted file mode 100644
index fde1ab79e1f..00000000000
--- a/library/std/src/sys/wasm/args.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-use crate::ffi::OsString;
-use crate::fmt;
-use crate::vec;
-
-pub fn args() -> Args {
-    Args { iter: Vec::new().into_iter() }
-}
-
-pub struct Args {
-    iter: vec::IntoIter<OsString>,
-}
-
-impl !Send for Args {}
-impl !Sync for Args {}
-
-impl fmt::Debug for Args {
-    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        self.iter.as_slice().fmt(f)
-    }
-}
-
-impl Iterator for Args {
-    type Item = OsString;
-    fn next(&mut self) -> Option<OsString> {
-        self.iter.next()
-    }
-    fn size_hint(&self) -> (usize, Option<usize>) {
-        self.iter.size_hint()
-    }
-}
-
-impl ExactSizeIterator for Args {
-    fn len(&self) -> usize {
-        self.iter.len()
-    }
-}
-
-impl DoubleEndedIterator for Args {
-    fn next_back(&mut self) -> Option<OsString> {
-        self.iter.next_back()
-    }
-}
diff --git a/library/std/src/sys/wasm/condvar_atomics.rs b/library/std/src/sys/wasm/atomics/condvar.rs
index 0c1c076cc91..0c1c076cc91 100644
--- a/library/std/src/sys/wasm/condvar_atomics.rs
+++ b/library/std/src/sys/wasm/atomics/condvar.rs
diff --git a/library/std/src/sys/wasm/futex_atomics.rs b/library/std/src/sys/wasm/atomics/futex.rs
index 3d8bf42f725..3d8bf42f725 100644
--- a/library/std/src/sys/wasm/futex_atomics.rs
+++ b/library/std/src/sys/wasm/atomics/futex.rs
diff --git a/library/std/src/sys/wasm/mutex_atomics.rs b/library/std/src/sys/wasm/atomics/mutex.rs
index 5ff0ec052b6..5ff0ec052b6 100644
--- a/library/std/src/sys/wasm/mutex_atomics.rs
+++ b/library/std/src/sys/wasm/atomics/mutex.rs
diff --git a/library/std/src/sys/wasm/rwlock_atomics.rs b/library/std/src/sys/wasm/atomics/rwlock.rs
index 06442e925f4..06442e925f4 100644
--- a/library/std/src/sys/wasm/rwlock_atomics.rs
+++ b/library/std/src/sys/wasm/atomics/rwlock.rs
diff --git a/library/std/src/sys/wasm/thread.rs b/library/std/src/sys/wasm/atomics/thread.rs
index b7bf95c89b4..54bc877aa7d 100644
--- a/library/std/src/sys/wasm/thread.rs
+++ b/library/std/src/sys/wasm/atomics/thread.rs
@@ -13,20 +13,10 @@ impl Thread {
         unsupported()
     }
 
-    pub fn yield_now() {
-        // do nothing
-    }
+    pub fn yield_now() {}
 
-    pub fn set_name(_name: &CStr) {
-        // nope
-    }
+    pub fn set_name(_name: &CStr) {}
 
-    #[cfg(not(target_feature = "atomics"))]
-    pub fn sleep(_dur: Duration) {
-        panic!("can't sleep");
-    }
-
-    #[cfg(target_feature = "atomics")]
     pub fn sleep(dur: Duration) {
         use crate::arch::wasm32;
         use crate::cmp;
@@ -46,9 +36,7 @@ impl Thread {
         }
     }
 
-    pub fn join(self) {
-        self.0
-    }
+    pub fn join(self) {}
 }
 
 pub mod guard {
@@ -61,11 +49,9 @@ pub mod guard {
     }
 }
 
-// This is only used by atomics primitives when the `atomics` feature is
-// enabled. In that mode we currently just use our own thread-local to store our
+// We currently just use our own thread-local to store our
 // current thread's ID, and then we lazily initialize it to something allocated
 // from a global counter.
-#[cfg(target_feature = "atomics")]
 pub fn my_id() -> u32 {
     use crate::sync::atomic::{AtomicU32, Ordering::SeqCst};
 
diff --git a/library/std/src/sys/wasm/mod.rs b/library/std/src/sys/wasm/mod.rs
index afcc5ca9286..cd701a333f8 100644
--- a/library/std/src/sys/wasm/mod.rs
+++ b/library/std/src/sys/wasm/mod.rs
@@ -17,6 +17,7 @@
 #![deny(unsafe_op_in_unsafe_fn)]
 
 pub mod alloc;
+#[path = "../unsupported/args.rs"]
 pub mod args;
 #[path = "../unix/cmath.rs"]
 pub mod cmath;
@@ -37,7 +38,6 @@ pub mod pipe;
 pub mod process;
 #[path = "../unsupported/stdio.rs"]
 pub mod stdio;
-pub mod thread;
 #[path = "../unsupported/thread_local_dtor.rs"]
 pub mod thread_local_dtor;
 #[path = "../unsupported/thread_local_key.rs"]
@@ -49,14 +49,16 @@ pub use crate::sys_common::os_str_bytes as os_str;
 
 cfg_if::cfg_if! {
     if #[cfg(target_feature = "atomics")] {
-        #[path = "condvar_atomics.rs"]
+        #[path = "atomics/condvar.rs"]
         pub mod condvar;
-        #[path = "mutex_atomics.rs"]
+        #[path = "atomics/mutex.rs"]
         pub mod mutex;
-        #[path = "rwlock_atomics.rs"]
+        #[path = "atomics/rwlock.rs"]
         pub mod rwlock;
-        #[path = "futex_atomics.rs"]
+        #[path = "atomics/futex.rs"]
         pub mod futex;
+        #[path = "atomics/thread.rs"]
+        pub mod thread;
     } else {
         #[path = "../unsupported/condvar.rs"]
         pub mod condvar;
@@ -64,6 +66,8 @@ cfg_if::cfg_if! {
         pub mod mutex;
         #[path = "../unsupported/rwlock.rs"]
         pub mod rwlock;
+        #[path = "../unsupported/thread.rs"]
+        pub mod thread;
     }
 }