about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2018-10-23 02:04:42 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2018-11-10 01:10:07 +0100
commitf65b630d33ef2e57f0966c9b7b1f179e78502a9d (patch)
treeea421979aa80d87b2bf353247f29191c05754721 /src/libstd/sync
parent061d345c1657a86a9d94e90f916a0be8c966d062 (diff)
downloadrust-f65b630d33ef2e57f0966c9b7b1f179e78502a9d.tar.gz
rust-f65b630d33ef2e57f0966c9b7b1f179e78502a9d.zip
constify parts of libstd.
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/condvar.rs2
-rw-r--r--src/libstd/sync/mpsc/mod.rs6
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs2
-rw-r--r--src/libstd/sync/once.rs2
4 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs
index 3014283da5b..1c6cc9cb361 100644
--- a/src/libstd/sync/condvar.rs
+++ b/src/libstd/sync/condvar.rs
@@ -72,7 +72,7 @@ impl WaitTimeoutResult {
     /// }
     /// ```
     #[stable(feature = "wait_timeout", since = "1.5.0")]
-    pub fn timed_out(&self) -> bool {
+    pub const fn timed_out(&self) -> bool {
         self.0
     }
 }
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index 059ced4f56e..2a2e5c030b3 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -785,7 +785,7 @@ pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
 ////////////////////////////////////////////////////////////////////////////////
 
 impl<T> Sender<T> {
-    fn new(inner: Flavor<T>) -> Sender<T> {
+    const fn new(inner: Flavor<T>) -> Sender<T> {
         Sender {
             inner: UnsafeCell::new(inner),
         }
@@ -1469,7 +1469,7 @@ impl<T> Receiver<T> {
     /// assert_eq!(iter.next(), None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn iter(&self) -> Iter<T> {
+    pub const fn iter(&self) -> Iter<T> {
         Iter { rx: self }
     }
 
@@ -1512,7 +1512,7 @@ impl<T> Receiver<T> {
     /// assert_eq!(iter.next(), None);
     /// ```
     #[stable(feature = "receiver_try_iter", since = "1.15.0")]
-    pub fn try_iter(&self) -> TryIter<T> {
+    pub const fn try_iter(&self) -> TryIter<T> {
         TryIter { rx: self }
     }
 
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index b8e50c9297b..273644cb902 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -89,7 +89,7 @@ enum MyUpgrade<T> {
 }
 
 impl<T> Packet<T> {
-    pub fn new() -> Packet<T> {
+    pub const fn new() -> Packet<T> {
         Packet {
             data: UnsafeCell::new(None),
             upgrade: UnsafeCell::new(NothingSent),
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index cf9698cb2a9..4dd37ec3878 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -517,7 +517,7 @@ impl OnceState {
     ///     assert!(!state.poisoned());
     /// });
     #[unstable(feature = "once_poison", issue = "33577")]
-    pub fn poisoned(&self) -> bool {
+    pub const fn poisoned(&self) -> bool {
         self.poisoned
     }
 }