about summary refs log tree commit diff
path: root/src/libstd/rt
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/rt
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/rt')
-rw-r--r--src/libstd/rt/libunwind.rs24
-rw-r--r--src/libstd/rt/local_heap.rs8
-rw-r--r--src/libstd/rt/local_ptr.rs2
-rw-r--r--src/libstd/rt/rtio.rs8
-rw-r--r--src/libstd/rt/task.rs28
-rw-r--r--src/libstd/rt/thread.rs6
-rw-r--r--src/libstd/rt/unwind.rs4
7 files changed, 39 insertions, 41 deletions
diff --git a/src/libstd/rt/libunwind.rs b/src/libstd/rt/libunwind.rs
index e9a925fb897..4fd610d7423 100644
--- a/src/libstd/rt/libunwind.rs
+++ b/src/libstd/rt/libunwind.rs
@@ -17,8 +17,7 @@ use libc;
 
 #[cfg(not(target_arch = "arm"))]
 #[repr(C)]
-pub enum _Unwind_Action
-{
+pub enum _Unwind_Action {
     _UA_SEARCH_PHASE = 1,
     _UA_CLEANUP_PHASE = 2,
     _UA_HANDLER_FRAME = 4,
@@ -28,14 +27,13 @@ pub enum _Unwind_Action
 
 #[cfg(target_arch = "arm")]
 #[repr(C)]
-pub enum _Unwind_State
-{
-  _US_VIRTUAL_UNWIND_FRAME = 0,
-  _US_UNWIND_FRAME_STARTING = 1,
-  _US_UNWIND_FRAME_RESUME = 2,
-  _US_ACTION_MASK = 3,
-  _US_FORCE_UNWIND = 8,
-  _US_END_OF_STACK = 16
+pub enum _Unwind_State {
+    _US_VIRTUAL_UNWIND_FRAME = 0,
+    _US_UNWIND_FRAME_STARTING = 1,
+    _US_UNWIND_FRAME_RESUME = 2,
+    _US_ACTION_MASK = 3,
+    _US_FORCE_UNWIND = 8,
+    _US_END_OF_STACK = 16
 }
 
 #[repr(C)]
@@ -69,9 +67,9 @@ pub static unwinder_private_data_size: int = 20;
 pub static unwinder_private_data_size: int = 2;
 
 pub struct _Unwind_Exception {
-    exception_class: _Unwind_Exception_Class,
-    exception_cleanup: _Unwind_Exception_Cleanup_Fn,
-    private: [_Unwind_Word, ..unwinder_private_data_size],
+    pub exception_class: _Unwind_Exception_Class,
+    pub exception_cleanup: _Unwind_Exception_Cleanup_Fn,
+    pub private: [_Unwind_Word, ..unwinder_private_data_size],
 }
 
 pub enum _Unwind_Context {}
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index 1b643e8dab2..163e69f9686 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -33,14 +33,14 @@ static MAGIC: u32 = 0xbadc0ffe;
 pub type Box = raw::Box<()>;
 
 pub struct MemoryRegion {
-    priv allocations: Vec<*AllocHeader>,
-    priv live_allocations: uint,
+    allocations: Vec<*AllocHeader>,
+    live_allocations: uint,
 }
 
 pub struct LocalHeap {
-    priv memory_region: MemoryRegion,
+    memory_region: MemoryRegion,
 
-    priv live_allocs: *mut raw::Box<()>,
+    live_allocs: *mut raw::Box<()>,
 }
 
 impl LocalHeap {
diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs
index 30068712977..e486932ac3c 100644
--- a/src/libstd/rt/local_ptr.rs
+++ b/src/libstd/rt/local_ptr.rs
@@ -31,7 +31,7 @@ pub use self::compiled::*;
 /// Encapsulates a borrowed value. When this value goes out of scope, the
 /// pointer is returned.
 pub struct Borrowed<T> {
-    priv val: *(),
+    val: *(),
 }
 
 #[unsafe_destructor]
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs
index 5f0f0afd185..54708d19a1b 100644
--- a/src/libstd/rt/rtio.rs
+++ b/src/libstd/rt/rtio.rs
@@ -61,11 +61,11 @@ pub trait RemoteCallback {
 /// libuv (it does translation to windows under the hood).
 pub struct FileOpenConfig {
     /// Path to file to be opened
-    path: Path,
+    pub path: Path,
     /// Flags for file access mode (as per open(2))
-    flags: int,
+    pub flags: int,
     /// File creation mode, ignored unless O_CREAT is passed as part of flags
-    priv mode: int
+    pub mode: int
 }
 
 /// Description of what to do when a file handle is closed
@@ -83,7 +83,7 @@ pub enum CloseBehavior {
 }
 
 pub struct LocalIo<'a> {
-    priv factory: &'a mut IoFactory,
+    factory: &'a mut IoFactory,
 }
 
 #[unsafe_destructor]
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 211c09977d4..d9700ea9980 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -43,18 +43,18 @@ use unstable::finally::Finally;
 /// in the struct. This contains a pointer to another struct that holds
 /// the type-specific state.
 pub struct Task {
-    heap: LocalHeap,
-    gc: GarbageCollector,
-    storage: LocalStorage,
-    unwinder: Unwinder,
-    death: Death,
-    destroyed: bool,
-    name: Option<SendStr>,
-
-    stdout: Option<~Writer:Send>,
-    stderr: Option<~Writer:Send>,
-
-    priv imp: Option<~Runtime:Send>,
+    pub heap: LocalHeap,
+    pub gc: GarbageCollector,
+    pub storage: LocalStorage,
+    pub unwinder: Unwinder,
+    pub death: Death,
+    pub destroyed: bool,
+    pub name: Option<SendStr>,
+
+    pub stdout: Option<~Writer:Send>,
+    pub stderr: Option<~Writer:Send>,
+
+    imp: Option<~Runtime:Send>,
 }
 
 pub struct GarbageCollector;
@@ -77,11 +77,11 @@ pub enum DeathAction {
 
 /// Per-task state related to task death, killing, failure, etc.
 pub struct Death {
-    on_exit: Option<DeathAction>,
+    pub on_exit: Option<DeathAction>,
 }
 
 pub struct BlockedTasks {
-    priv inner: UnsafeArc<AtomicUint>,
+    inner: UnsafeArc<AtomicUint>,
 }
 
 impl Task {
diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs
index 1802016e3b3..c35ffac064c 100644
--- a/src/libstd/rt/thread.rs
+++ b/src/libstd/rt/thread.rs
@@ -28,9 +28,9 @@ type StartFn = extern "C" fn(*libc::c_void) -> imp::rust_thread_return;
 /// This struct represents a native thread's state. This is used to join on an
 /// existing thread created in the join-able state.
 pub struct Thread<T> {
-    priv native: imp::rust_thread,
-    priv joined: bool,
-    priv packet: ~Option<T>,
+    native: imp::rust_thread,
+    joined: bool,
+    packet: ~Option<T>,
 }
 
 static DEFAULT_STACK_SIZE: uint = 1024 * 1024;
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 930e0858da1..68d63949ae6 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -75,8 +75,8 @@ use intrinsics;
 use uw = rt::libunwind;
 
 pub struct Unwinder {
-    priv unwinding: bool,
-    priv cause: Option<~Any:Send>
+    unwinding: bool,
+    cause: Option<~Any:Send>
 }
 
 impl Unwinder {