about summary refs log tree commit diff
path: root/src/libstd/comm
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-03-31 15:51:33 -0700
committerbors <bors@rust-lang.org>2014-03-31 15:51:33 -0700
commitb8ef9fd9c9f642ce7b8aed82782a1ed745d08d64 (patch)
tree1e66451d207e19694d62608a8e1724c71796dc00 /src/libstd/comm
parenta7e057d402a345f547e67a326871621472d04035 (diff)
parent37a3131640d0fa2633aa26db7f849d110250ce51 (diff)
downloadrust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.tar.gz
rust-b8ef9fd9c9f642ce7b8aed82782a1ed745d08d64.zip
auto merge of #13184 : alexcrichton/rust/priv-fields, r=brson
This is an implementation of a portion of [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md). This PR makes named struct fields private by default (as opposed to inherited by default).

The only real meaty change is the first commit to `rustc`, all other commits are just fallout of that change.

Summary of changes made:

* Named fields are private by default *everywhere*
* The `priv` keyword is now default-deny on named fields (done in a "lint" pass in privacy)

Changes yet to be done (before the RFC is closed)

* Change tuple structs to have private fields by default
* Remove `priv` enum variants
* Make `priv` a reserved keyword
Diffstat (limited to 'src/libstd/comm')
-rw-r--r--src/libstd/comm/mod.rs18
-rw-r--r--src/libstd/comm/select.rs22
2 files changed, 20 insertions, 20 deletions
diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs
index ef8894a258c..e951077ac83 100644
--- a/src/libstd/comm/mod.rs
+++ b/src/libstd/comm/mod.rs
@@ -289,34 +289,34 @@ static RESCHED_FREQ: int = 256;
 /// The receiving-half of Rust's channel type. This half can only be owned by
 /// one task
 pub struct Receiver<T> {
-    priv inner: Flavor<T>,
-    priv receives: Cell<uint>,
+    inner: Flavor<T>,
+    receives: Cell<uint>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// 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.
 pub struct Messages<'a, T> {
-    priv rx: &'a Receiver<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.
 pub struct Sender<T> {
-    priv inner: Flavor<T>,
-    priv sends: Cell<uint>,
+    inner: Flavor<T>,
+    sends: Cell<uint>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// The sending-half of Rust's synchronous channel type. This half can only be
 /// owned by one task, but it can be cloned to send to other tasks.
 pub struct SyncSender<T> {
-    priv inner: UnsafeArc<sync::Packet<T>>,
+    inner: UnsafeArc<sync::Packet<T>>,
     // can't share in an arc
-    priv marker: marker::NoShare,
+    marker: marker::NoShare,
 }
 
 /// This enumeration is the list of the possible reasons that try_recv could not
diff --git a/src/libstd/comm/select.rs b/src/libstd/comm/select.rs
index 23bbb5a5611..84191ed6b28 100644
--- a/src/libstd/comm/select.rs
+++ b/src/libstd/comm/select.rs
@@ -62,10 +62,10 @@ use uint;
 /// The "receiver set" of the select interface. This structure is used to manage
 /// a set of receivers which are being selected over.
 pub struct Select {
-    priv head: *mut Handle<'static, ()>,
-    priv tail: *mut Handle<'static, ()>,
-    priv next_id: Cell<uint>,
-    priv marker1: marker::NoSend,
+    head: *mut Handle<'static, ()>,
+    tail: *mut Handle<'static, ()>,
+    next_id: Cell<uint>,
+    marker1: marker::NoSend,
 }
 
 /// A handle to a receiver which is currently a member of a `Select` set of
@@ -74,16 +74,16 @@ pub struct Select {
 pub struct Handle<'rx, T> {
     /// The ID of this handle, used to compare against the return value of
     /// `Select::wait()`
-    priv id: uint,
-    priv selector: &'rx Select,
-    priv next: *mut Handle<'static, ()>,
-    priv prev: *mut Handle<'static, ()>,
-    priv added: bool,
-    priv packet: &'rx Packet,
+    id: uint,
+    selector: &'rx Select,
+    next: *mut Handle<'static, ()>,
+    prev: *mut Handle<'static, ()>,
+    added: bool,
+    packet: &'rx Packet,
 
     // due to our fun transmutes, we be sure to place this at the end. (nothing
     // previous relies on T)
-    priv rx: &'rx Receiver<T>,
+    rx: &'rx Receiver<T>,
 }
 
 struct Packets { cur: *mut Handle<'static, ()> }