about summary refs log tree commit diff
path: root/src/libstd/sync
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/sync
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/sync')
-rw-r--r--src/libstd/sync/arc.rs2
-rw-r--r--src/libstd/sync/atomics.rs18
-rw-r--r--src/libstd/sync/deque.rs6
-rw-r--r--src/libstd/sync/mpmc_bounded_queue.rs2
-rw-r--r--src/libstd/sync/mpsc_queue.rs4
-rw-r--r--src/libstd/sync/spsc_queue.rs16
6 files changed, 24 insertions, 24 deletions
diff --git a/src/libstd/sync/arc.rs b/src/libstd/sync/arc.rs
index 92974005305..0d0bd740e41 100644
--- a/src/libstd/sync/arc.rs
+++ b/src/libstd/sync/arc.rs
@@ -35,7 +35,7 @@ use ty::Unsafe;
 /// Enforces no shared-memory safety.
 #[unsafe_no_drop_flag]
 pub struct UnsafeArc<T> {
-    priv data: *mut ArcData<T>,
+    data: *mut ArcData<T>,
 }
 
 struct ArcData<T> {
diff --git a/src/libstd/sync/atomics.rs b/src/libstd/sync/atomics.rs
index 6cc2f85bd95..234eae1f97b 100644
--- a/src/libstd/sync/atomics.rs
+++ b/src/libstd/sync/atomics.rs
@@ -116,26 +116,26 @@ use ty::Unsafe;
 
 /// An atomic boolean type.
 pub struct AtomicBool {
-    priv v: Unsafe<uint>,
-    priv nocopy: marker::NoCopy
+    v: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// A signed atomic integer type, supporting basic atomic arithmetic operations
 pub struct AtomicInt {
-    priv v: Unsafe<int>,
-    priv nocopy: marker::NoCopy
+    v: Unsafe<int>,
+    nocopy: marker::NoCopy
 }
 
 /// An unsigned atomic integer type, supporting basic atomic arithmetic operations
 pub struct AtomicUint {
-    priv v: Unsafe<uint>,
-    priv nocopy: marker::NoCopy
+    v: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// An unsafe atomic pointer. Only supports basic atomic operations
 pub struct AtomicPtr<T> {
-    priv p: Unsafe<uint>,
-    priv nocopy: marker::NoCopy
+    p: Unsafe<uint>,
+    nocopy: marker::NoCopy
 }
 
 /// An atomic, nullable unique pointer
@@ -144,7 +144,7 @@ pub struct AtomicPtr<T> {
 /// owned heap objects across tasks.
 #[unsafe_no_drop_flag]
 pub struct AtomicOption<T> {
-    priv p: Unsafe<uint>,
+    p: Unsafe<uint>,
 }
 
 /// Atomic memory orderings
diff --git a/src/libstd/sync/deque.rs b/src/libstd/sync/deque.rs
index 80a5b9ce3bb..d01c89878de 100644
--- a/src/libstd/sync/deque.rs
+++ b/src/libstd/sync/deque.rs
@@ -86,14 +86,14 @@ struct Deque<T> {
 ///
 /// There may only be one worker per deque.
 pub struct Worker<T> {
-    priv deque: UnsafeArc<Deque<T>>,
+    deque: UnsafeArc<Deque<T>>,
 }
 
 /// The stealing half of the work-stealing deque. Stealers have access to the
 /// opposite end of the deque from the worker, and they only have access to the
 /// `steal` method.
 pub struct Stealer<T> {
-    priv deque: UnsafeArc<Deque<T>>,
+    deque: UnsafeArc<Deque<T>>,
 }
 
 /// When stealing some data, this is an enumeration of the possible outcomes.
@@ -116,7 +116,7 @@ pub enum Stolen<T> {
 /// will only use this structure when allocating a new buffer or deallocating a
 /// previous one.
 pub struct BufferPool<T> {
-    priv pool: Exclusive<~[~Buffer<T>]>,
+    pool: Exclusive<~[~Buffer<T>]>,
 }
 
 /// An internal buffer used by the chase-lev deque. This structure is actually
diff --git a/src/libstd/sync/mpmc_bounded_queue.rs b/src/libstd/sync/mpmc_bounded_queue.rs
index dfa962cdb80..12c05c0d61c 100644
--- a/src/libstd/sync/mpmc_bounded_queue.rs
+++ b/src/libstd/sync/mpmc_bounded_queue.rs
@@ -54,7 +54,7 @@ struct State<T> {
 }
 
 pub struct Queue<T> {
-    priv state: UnsafeArc<State<T>>,
+    state: UnsafeArc<State<T>>,
 }
 
 impl<T: Send> State<T> {
diff --git a/src/libstd/sync/mpsc_queue.rs b/src/libstd/sync/mpsc_queue.rs
index 9d69f2b3b08..142a6239df6 100644
--- a/src/libstd/sync/mpsc_queue.rs
+++ b/src/libstd/sync/mpsc_queue.rs
@@ -67,8 +67,8 @@ struct Node<T> {
 /// may be safely shared so long as it is guaranteed that there is only one
 /// popper at a time (many pushers are allowed).
 pub struct Queue<T> {
-    priv head: AtomicPtr<Node<T>>,
-    priv tail: *mut Node<T>,
+    head: AtomicPtr<Node<T>>,
+    tail: *mut Node<T>,
 }
 
 impl<T> Node<T> {
diff --git a/src/libstd/sync/spsc_queue.rs b/src/libstd/sync/spsc_queue.rs
index 9277587e587..4e043ecf171 100644
--- a/src/libstd/sync/spsc_queue.rs
+++ b/src/libstd/sync/spsc_queue.rs
@@ -55,19 +55,19 @@ struct Node<T> {
 /// time.
 pub struct Queue<T> {
     // consumer fields
-    priv tail: *mut Node<T>, // where to pop from
-    priv tail_prev: AtomicPtr<Node<T>>, // where to pop from
+    tail: *mut Node<T>, // where to pop from
+    tail_prev: AtomicPtr<Node<T>>, // where to pop from
 
     // producer fields
-    priv head: *mut Node<T>,      // where to push to
-    priv first: *mut Node<T>,     // where to get new nodes from
-    priv tail_copy: *mut Node<T>, // between first/tail
+    head: *mut Node<T>,      // where to push to
+    first: *mut Node<T>,     // where to get new nodes from
+    tail_copy: *mut Node<T>, // between first/tail
 
     // Cache maintenance fields. Additions and subtractions are stored
     // separately in order to allow them to use nonatomic addition/subtraction.
-    priv cache_bound: uint,
-    priv cache_additions: AtomicUint,
-    priv cache_subtractions: AtomicUint,
+    cache_bound: uint,
+    cache_additions: AtomicUint,
+    cache_subtractions: AtomicUint,
 }
 
 impl<T: Send> Node<T> {