]> git.lizzy.rs Git - rust.git/blobdiff - src/libsync/comm/mod.rs
rollup merge of #17355 : gamazeps/issue17210
[rust.git] / src / libsync / comm / mod.rs
index 16f6eea6144f8afd4f694f7e0e362d188f26645c..4e66dd69a607b932d357d04843d6a92293520402 100644 (file)
@@ -379,25 +379,17 @@ pub struct Receiver<T> {
     inner: UnsafeCell<Flavor<T>>,
     receives: Cell<uint>,
     // can't share in an arc
-    marker: marker::NoSync,
+    _marker: marker::NoSync,
 }
 
 /// An iterator over messages on a receiver, this iterator will block
 /// whenever `next` is called, waiting for a new message, and `None` will be
 /// returned when the corresponding channel has hung up.
 #[unstable]
-#[cfg(not(stage0))]
 pub struct Messages<'a, T:'a> {
     rx: &'a Receiver<T>
 }
 
-/// Stage0 only
-#[cfg(stage0)]
-#[unstable]
-pub struct Messages<'a, T> {
-    rx: &'a Receiver<T>
-}
-
 /// The sending-half of Rust's asynchronous channel type. This half can only be
 /// owned by one task, but it can be cloned to send to other tasks.
 #[unstable]
@@ -405,7 +397,7 @@ pub struct Sender<T> {
     inner: UnsafeCell<Flavor<T>>,
     sends: Cell<uint>,
     // can't share in an arc
-    marker: marker::NoSync,
+    _marker: marker::NoSync,
 }
 
 /// The sending-half of Rust's synchronous channel type. This half can only be
@@ -414,7 +406,7 @@ pub struct Sender<T> {
 pub struct SyncSender<T> {
     inner: Arc<UnsafeCell<sync::Packet<T>>>,
     // can't share in an arc
-    marker: marker::NoSync,
+    _marker: marker::NoSync,
 }
 
 /// This enumeration is the list of the possible reasons that try_recv could not
@@ -457,7 +449,7 @@ enum Flavor<T> {
 #[doc(hidden)]
 trait UnsafeFlavor<T> {
     fn inner_unsafe<'a>(&'a self) -> &'a UnsafeCell<Flavor<T>>;
-    unsafe fn mut_inner<'a>(&'a self) -> &'a mut Flavor<T> {
+    unsafe fn inner_mut<'a>(&'a self) -> &'a mut Flavor<T> {
         &mut *self.inner_unsafe().get()
     }
     unsafe fn inner<'a>(&'a self) -> &'a Flavor<T> {
@@ -551,7 +543,7 @@ fn new(inner: Flavor<T>) -> Sender<T> {
         Sender {
             inner: UnsafeCell::new(inner),
             sends: Cell::new(0),
-            marker: marker::NoSync,
+            _marker: marker::NoSync,
         }
     }
 
@@ -662,7 +654,7 @@ pub fn send_opt(&self, t: T) -> Result<(), T> {
 
         unsafe {
             let tmp = Sender::new(Stream(new_inner));
-            mem::swap(self.mut_inner(), tmp.mut_inner());
+            mem::swap(self.inner_mut(), tmp.inner_mut());
         }
         return ret;
     }
@@ -703,7 +695,7 @@ fn clone(&self) -> Sender<T> {
             (*packet.get()).inherit_blocker(sleeper);
 
             let tmp = Sender::new(Shared(packet.clone()));
-            mem::swap(self.mut_inner(), tmp.mut_inner());
+            mem::swap(self.inner_mut(), tmp.inner_mut());
         }
         Sender::new(Shared(packet))
     }
@@ -712,7 +704,7 @@ fn clone(&self) -> Sender<T> {
 #[unsafe_destructor]
 impl<T: Send> Drop for Sender<T> {
     fn drop(&mut self) {
-        match *unsafe { self.mut_inner() } {
+        match *unsafe { self.inner_mut() } {
             Oneshot(ref mut p) => unsafe { (*p.get()).drop_chan(); },
             Stream(ref mut p) => unsafe { (*p.get()).drop_chan(); },
             Shared(ref mut p) => unsafe { (*p.get()).drop_chan(); },
@@ -727,7 +719,7 @@ fn drop(&mut self) {
 
 impl<T: Send> SyncSender<T> {
     fn new(inner: Arc<UnsafeCell<sync::Packet<T>>>) -> SyncSender<T> {
-        SyncSender { inner: inner, marker: marker::NoSync }
+        SyncSender { inner: inner, _marker: marker::NoSync }
     }
 
     /// Sends a value on this synchronous channel.
@@ -815,7 +807,7 @@ fn drop(&mut self) {
 
 impl<T: Send> Receiver<T> {
     fn new(inner: Flavor<T>) -> Receiver<T> {
-        Receiver { inner: UnsafeCell::new(inner), receives: Cell::new(0), marker: marker::NoSync }
+        Receiver { inner: UnsafeCell::new(inner), receives: Cell::new(0), _marker: marker::NoSync }
     }
 
     /// Blocks waiting for a value on this receiver
@@ -903,8 +895,8 @@ pub fn try_recv(&self) -> Result<T, TryRecvError> {
                 }
             };
             unsafe {
-                mem::swap(self.mut_inner(),
-                          new_port.mut_inner());
+                mem::swap(self.inner_mut(),
+                          new_port.inner_mut());
             }
         }
     }
@@ -951,7 +943,7 @@ pub fn recv_opt(&self) -> Result<T, ()> {
                 Sync(ref p) => return unsafe { (*p.get()).recv() }
             };
             unsafe {
-                mem::swap(self.mut_inner(), new_port.mut_inner());
+                mem::swap(self.inner_mut(), new_port.inner_mut());
             }
         }
     }
@@ -988,8 +980,8 @@ fn can_recv(&self) -> bool {
                 }
             };
             unsafe {
-                mem::swap(self.mut_inner(),
-                          new_port.mut_inner());
+                mem::swap(self.inner_mut(),
+                          new_port.inner_mut());
             }
         }
     }
@@ -1020,8 +1012,8 @@ fn start_selection(&self, mut task: BlockedTask) -> Result<(), BlockedTask>{
             };
             task = t;
             unsafe {
-                mem::swap(self.mut_inner(),
-                          new_port.mut_inner());
+                mem::swap(self.inner_mut(),
+                          new_port.inner_mut());
             }
         }
     }
@@ -1044,8 +1036,8 @@ fn abort_selection(&self) -> bool {
             let new_port = match result { Ok(b) => return b, Err(p) => p };
             was_upgrade = true;
             unsafe {
-                mem::swap(self.mut_inner(),
-                          new_port.mut_inner());
+                mem::swap(self.inner_mut(),
+                          new_port.inner_mut());
             }
         }
     }
@@ -1059,7 +1051,7 @@ fn next(&mut self) -> Option<T> { self.rx.recv_opt().ok() }
 #[unsafe_destructor]
 impl<T: Send> Drop for Receiver<T> {
     fn drop(&mut self) {
-        match *unsafe { self.mut_inner() } {
+        match *unsafe { self.inner_mut() } {
             Oneshot(ref mut p) => unsafe { (*p.get()).drop_port(); },
             Stream(ref mut p) => unsafe { (*p.get()).drop_port(); },
             Shared(ref mut p) => unsafe { (*p.get()).drop_port(); },