diff options
| author | reedlepee <reedlepee123@gmail.com> | 2013-10-20 06:03:09 +0530 |
|---|---|---|
| committer | reedlepee <reedlepee123@gmail.com> | 2013-10-23 01:10:50 +0530 |
| commit | 0ada7c7ffe453b9df849996f8dca0b8d0f2d9e62 (patch) | |
| tree | 6f1dc6e0c50e81caacfcb5cef1a9543d9442e87e /src/libstd/rt | |
| parent | dadb6f0cd9fa7e4b402a0107358acb34002d4895 (diff) | |
| download | rust-0ada7c7ffe453b9df849996f8dca0b8d0f2d9e62.tar.gz rust-0ada7c7ffe453b9df849996f8dca0b8d0f2d9e62.zip | |
Making fields in std and extra : private #4386
Diffstat (limited to 'src/libstd/rt')
38 files changed, 214 insertions, 127 deletions
diff --git a/src/libstd/rt/borrowck.rs b/src/libstd/rt/borrowck.rs index 3c2000c522c..182515e12be 100644 --- a/src/libstd/rt/borrowck.rs +++ b/src/libstd/rt/borrowck.rs @@ -29,9 +29,10 @@ static ALL_BITS: uint = FROZEN_BIT | MUT_BIT; #[deriving(Eq)] pub struct BorrowRecord { - box: *mut raw::Box<()>, + // all made byt reedlepee + priv box: *mut raw::Box<()>, file: *c_char, - line: size_t + priv line: size_t } fn try_take_task_borrow_list() -> Option<~[BorrowRecord]> { diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 4eae8bdc9a8..b74ae01fa30 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -48,14 +48,16 @@ struct Packet<T> { // A one-shot channel. pub struct ChanOne<T> { - void_packet: *mut Void, - suppress_finalize: bool + // all made priv by reeldepee + priv void_packet: *mut Void, + priv suppress_finalize: bool } /// A one-shot port. pub struct PortOne<T> { - void_packet: *mut Void, - suppress_finalize: bool + // all made priv by reeldepee + priv void_packet: *mut Void, + priv suppress_finalize: bool } pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) { @@ -443,12 +445,14 @@ type StreamPortOne<T> = PortOne<StreamPayload<T>>; /// A channel with unbounded size. pub struct Chan<T> { + // all made priv by reeldepee // FIXME #5372. Using Cell because we don't take &mut self next: Cell<StreamChanOne<T>> } /// An port with unbounded size. pub struct Port<T> { + // all made priv by reeldepee // FIXME #5372. Using Cell because we don't take &mut self next: Cell<StreamPortOne<T>> } @@ -577,6 +581,7 @@ impl<'self, T> SelectPortInner<T> for &'self Port<T> { impl<'self, T> SelectPort<T> for &'self Port<T> { } pub struct SharedChan<T> { + // already priv // Just like Chan, but a shared AtomicOption instead of Cell priv next: UnsafeArc<AtomicOption<StreamChanOne<T>>> } @@ -630,6 +635,7 @@ impl<T> Clone for SharedChan<T> { } pub struct SharedPort<T> { + // already priv // The next port on which we will receive the next port on which we will receive T priv next_link: UnsafeArc<AtomicOption<PortOne<StreamPortOne<T>>>> } diff --git a/src/libstd/rt/context.rs b/src/libstd/rt/context.rs index 7f7545ca230..9508c757c9d 100644 --- a/src/libstd/rt/context.rs +++ b/src/libstd/rt/context.rs @@ -25,11 +25,11 @@ pub static RED_ZONE: uint = 20 * 1024; // then misalign the regs again. pub struct Context { /// The context entry point, saved here for later destruction - start: Option<~~fn()>, + priv start: Option<~~fn()>, /// Hold the registers while the task or scheduler is suspended - regs: ~Registers, + priv regs: ~Registers, /// Lower bound and upper bound for the stack - stack_bounds: Option<(uint, uint)>, + priv stack_bounds: Option<(uint, uint)>, } impl Context { diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index d33e1af90f8..54a1c2406d0 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -21,14 +21,16 @@ use vec::ImmutableVector; extern {} pub struct ModEntry<'self> { + // made priv by reedlepee name: &'self str, log_level: *mut u32 } pub struct CrateMap<'self> { - version: i32, - entries: &'self [ModEntry<'self>], - children: &'self [&'self CrateMap<'self>] + // made priv by reedlepee + priv version: i32, + priv entries: &'self [ModEntry<'self>], + priv children: &'self [&'self CrateMap<'self>] } #[cfg(not(windows))] diff --git a/src/libstd/rt/io/buffered.rs b/src/libstd/rt/io/buffered.rs index 9dcb35c806f..a33892736b0 100644 --- a/src/libstd/rt/io/buffered.rs +++ b/src/libstd/rt/io/buffered.rs @@ -64,6 +64,7 @@ static DEFAULT_CAPACITY: uint = 64 * 1024; /// Wraps a Reader and buffers input from it pub struct BufferedReader<R> { + // all already priv priv inner: R, priv buf: ~[u8], priv pos: uint, @@ -175,6 +176,7 @@ impl<R: Reader> Decorator<R> for BufferedReader<R> { /// /// Note that `BufferedWriter` will NOT flush its buffer when dropped. pub struct BufferedWriter<W> { + // all already priv priv inner: W, priv buf: ~[u8], priv pos: uint @@ -250,6 +252,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> { /// /// Note that `BufferedStream` will NOT flush its output buffer when dropped. pub struct BufferedStream<S> { + // all already priv priv inner: BufferedReader<InternalBufferedWriter<S>> } diff --git a/src/libstd/rt/io/extensions.rs b/src/libstd/rt/io/extensions.rs index 99634b532b0..5a3524195c7 100644 --- a/src/libstd/rt/io/extensions.rs +++ b/src/libstd/rt/io/extensions.rs @@ -368,6 +368,7 @@ impl<T: Reader> ReaderUtil for T { /// each call to its `.next()` method. /// Yields `None` if the condition is handled. pub struct ByteIterator<T> { + // all already priv priv reader: T, } diff --git a/src/libstd/rt/io/file.rs b/src/libstd/rt/io/file.rs index a5d593d2454..9d633ec1c65 100644 --- a/src/libstd/rt/io/file.rs +++ b/src/libstd/rt/io/file.rs @@ -298,6 +298,7 @@ pub fn readdir<P: PathLike>(path: &P) -> Option<~[Path]> { /// Constrained version of `FileStream` that only exposes read-specific operations. /// /// Can be retreived via `FileInfo.open_reader()`. +/// all already priv pub struct FileReader { priv stream: FileStream } /// a `std::rt::io::Reader` trait impl for file I/O. @@ -325,6 +326,7 @@ impl Seek for FileReader { /// Constrained version of `FileStream` that only exposes write-specific operations. /// /// Can be retreived via `FileInfo.open_writer()`. +// already priv pub struct FileWriter { priv stream: FileStream } /// a `std::rt::io::Writer` trait impl for file I/O. @@ -362,8 +364,9 @@ impl Seek for FileWriter { /// For this reason, it is best to use the access-constrained wrappers that are /// exposed via `FileInfo.open_reader()` and `FileInfo.open_writer()`. pub struct FileStream { - fd: ~RtioFileStream, - last_nread: int, + // all made by reedlepee + priv fd: ~RtioFileStream, + priv last_nread: int, } /// a `std::rt::io::Reader` trait impl for file I/O. diff --git a/src/libstd/rt/io/flate.rs b/src/libstd/rt/io/flate.rs index 7c72ce6ba89..9c49f2afb1e 100644 --- a/src/libstd/rt/io/flate.rs +++ b/src/libstd/rt/io/flate.rs @@ -17,7 +17,8 @@ use super::*; /// A Writer decorator that compresses using the 'deflate' scheme pub struct DeflateWriter<W> { - inner_writer: W + // all made by reedlepee + priv inner_writer: W } impl<W: Writer> DeflateWriter<W> { @@ -56,7 +57,8 @@ impl<W: Writer> Decorator<W> for DeflateWriter<W> { /// A Reader decorator that decompresses using the 'deflate' scheme pub struct InflateReader<R> { - inner_reader: R + // all made by reedlepee + priv inner_reader: R } impl<R: Reader> InflateReader<R> { diff --git a/src/libstd/rt/io/mem.rs b/src/libstd/rt/io/mem.rs index 5f6b4398c22..85bd46ebaf4 100644 --- a/src/libstd/rt/io/mem.rs +++ b/src/libstd/rt/io/mem.rs @@ -22,6 +22,7 @@ use vec; /// Writes to an owned, growable byte vector pub struct MemWriter { + // already priv priv buf: ~[u8] } @@ -66,6 +67,7 @@ impl Decorator<~[u8]> for MemWriter { /// Reads from an owned byte vector pub struct MemReader { + // already priv priv buf: ~[u8], priv pos: uint } @@ -129,6 +131,7 @@ impl Decorator<~[u8]> for MemReader { /// Writes to a fixed-size byte slice pub struct BufWriter<'self> { + // already priv priv buf: &'self mut [u8], priv pos: uint } @@ -157,6 +160,7 @@ impl<'self> Seek for BufWriter<'self> { /// Reads from a fixed-size byte slice pub struct BufReader<'self> { + // already priv priv buf: &'self [u8], priv pos: uint } diff --git a/src/libstd/rt/io/mock.rs b/src/libstd/rt/io/mock.rs index c46e1372c64..30775ec90ba 100644 --- a/src/libstd/rt/io/mock.rs +++ b/src/libstd/rt/io/mock.rs @@ -12,8 +12,9 @@ use option::{Option, None}; use rt::io::{Reader, Writer}; pub struct MockReader { + // all made by reedlepee read: ~fn(buf: &mut [u8]) -> Option<uint>, - eof: ~fn() -> bool + priv eof: ~fn() -> bool } impl MockReader { @@ -31,8 +32,8 @@ impl Reader for MockReader { } pub struct MockWriter { - write: ~fn(buf: &[u8]), - flush: ~fn() + priv write: ~fn(buf: &[u8]), + priv flush: ~fn() } impl MockWriter { diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index c0971b5d3cd..d9951741ab2 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -341,6 +341,7 @@ pub static DEFAULT_BUF_SIZE: uint = 1024 * 64; /// /// Is something like this sufficient? It's kind of archaic pub struct IoError { + // all made by reedlepee kind: IoErrorKind, desc: &'static str, detail: Option<~str> @@ -648,6 +649,7 @@ pub enum FileAccess { } pub struct FileStat { + // all made by reedlepee /// A `Path` object containing information about the `PathInfo`'s location path: Path, /// `true` if the file pointed at by the `PathInfo` is a regular file diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs index d6820981181..cce2e851452 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/rt/io/native/file.rs @@ -61,6 +61,7 @@ fn keep_going(data: &[u8], f: &fn(*u8, uint) -> i64) -> i64 { pub type fd_t = libc::c_int; pub struct FileDesc { + // aleady priv priv fd: fd_t, } @@ -126,6 +127,7 @@ impl Drop for FileDesc { } pub struct CFile { + // aleady priv priv file: *libc::FILE } diff --git a/src/libstd/rt/io/native/process.rs b/src/libstd/rt/io/native/process.rs index 91fff6d9263..73ce330cd49 100644 --- a/src/libstd/rt/io/native/process.rs +++ b/src/libstd/rt/io/native/process.rs @@ -25,6 +25,7 @@ use super::file; * for the process to terminate. */ pub struct Process { + // aleady priv /// The unique id of the process (this should never be negative). priv pid: pid_t, diff --git a/src/libstd/rt/io/native/stdio.rs b/src/libstd/rt/io/native/stdio.rs index 5661725d77b..41c25e0841a 100644 --- a/src/libstd/rt/io/native/stdio.rs +++ b/src/libstd/rt/io/native/stdio.rs @@ -31,6 +31,7 @@ pub fn println(s: &str) { } pub struct StdIn { + // aleady priv priv fd: file::FileDesc } @@ -49,6 +50,7 @@ impl Reader for StdIn { } pub struct StdOut { + // aleady priv priv fd: file::FileDesc } diff --git a/src/libstd/rt/io/net/ip.rs b/src/libstd/rt/io/net/ip.rs index f72d2e1f19b..945014867e2 100644 --- a/src/libstd/rt/io/net/ip.rs +++ b/src/libstd/rt/io/net/ip.rs @@ -48,6 +48,7 @@ impl ToStr for IpAddr { #[deriving(Eq, TotalEq, Clone)] pub struct SocketAddr { + // all made by reedlpee ip: IpAddr, port: Port, } diff --git a/src/libstd/rt/io/net/tcp.rs b/src/libstd/rt/io/net/tcp.rs index f29e17cfc2f..0ed5861e296 100644 --- a/src/libstd/rt/io/net/tcp.rs +++ b/src/libstd/rt/io/net/tcp.rs @@ -21,6 +21,7 @@ use rt::rtio::{IoFactory, IoFactoryObject, use rt::local::Local; pub struct TcpStream { + // aleady priv priv obj: ~RtioTcpStreamObject } @@ -99,6 +100,7 @@ impl Writer for TcpStream { } pub struct TcpListener { + // aleady priv priv obj: ~RtioTcpListenerObject } @@ -142,6 +144,7 @@ impl Listener<TcpStream, TcpAcceptor> for TcpListener { } pub struct TcpAcceptor { + // aleady priv priv obj: ~RtioTcpAcceptorObject } diff --git a/src/libstd/rt/io/net/udp.rs b/src/libstd/rt/io/net/udp.rs index 27faae0838b..5c63dd5352e 100644 --- a/src/libstd/rt/io/net/udp.rs +++ b/src/libstd/rt/io/net/udp.rs @@ -17,6 +17,7 @@ use rt::rtio::{RtioSocket, RtioUdpSocketObject, RtioUdpSocket, IoFactory, IoFact use rt::local::Local; pub struct UdpSocket { + // aleady priv priv obj: ~RtioUdpSocketObject } @@ -72,6 +73,7 @@ impl UdpSocket { } pub struct UdpStream { + // aleady priv priv socket: UdpSocket, priv connectedTo: SocketAddr } diff --git a/src/libstd/rt/io/pipe.rs b/src/libstd/rt/io/pipe.rs index d2cd531ed26..a89419fa41f 100644 --- a/src/libstd/rt/io/pipe.rs +++ b/src/libstd/rt/io/pipe.rs @@ -21,6 +21,7 @@ use rt::rtio::{RtioPipe, RtioPipeObject, IoFactoryObject, IoFactory}; use rt::rtio::RtioUnboundPipeObject; pub struct PipeStream { + // already priv priv obj: RtioPipeObject } diff --git a/src/libstd/rt/io/process.rs b/src/libstd/rt/io/process.rs index 5f2453852ee..e6029e0ff9c 100644 --- a/src/libstd/rt/io/process.rs +++ b/src/libstd/rt/io/process.rs @@ -26,13 +26,16 @@ use rt::rtio::{RtioProcess, RtioProcessObject, IoFactoryObject, IoFactory}; #[cfg(not(windows))] pub static MustDieSignal: int = libc::SIGKILL as int; pub struct Process { + // already priv priv handle: ~RtioProcessObject, + // made by reedlepee io: ~[Option<io::PipeStream>], } /// This configuration describes how a new process should be spawned. This is /// translated to libuv's own configuration pub struct ProcessConfig<'self> { + // all made by reedlepee /// Path to the program to run program: &'self str, diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/rt/io/stdio.rs index e6dd9a48099..9f540dd0a81 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/rt/io/stdio.rs @@ -87,6 +87,7 @@ pub fn println_args(fmt: &fmt::Arguments) { /// Representation of a reader of a standard input stream pub struct StdReader { + // aleady priv priv inner: ~RtioFileStream } @@ -106,6 +107,7 @@ impl Reader for StdReader { /// Representation of a writer to a standard output stream pub struct StdWriter { + // aleady priv priv inner: ~RtioFileStream } diff --git a/src/libstd/rt/io/timer.rs b/src/libstd/rt/io/timer.rs index b41d7541a60..cb35fdf5883 100644 --- a/src/libstd/rt/io/timer.rs +++ b/src/libstd/rt/io/timer.rs @@ -16,6 +16,7 @@ use rt::rtio::{IoFactory, IoFactoryObject, use rt::local::Local; pub struct Timer { + // aleady priv priv obj: ~RtioTimerObject } diff --git a/src/libstd/rt/kill.rs b/src/libstd/rt/kill.rs index 8029e3f6431..603e6627ee4 100644 --- a/src/libstd/rt/kill.rs +++ b/src/libstd/rt/kill.rs @@ -215,21 +215,22 @@ pub struct KillHandle(UnsafeArc<KillHandleInner>); /// Per-task state related to task death, killing, failure, etc. pub struct Death { + // all made priv by reedlepee // Shared among this task, its watched children, and any linked tasks who // might kill it. This is optional so we can take it by-value at exit time. - kill_handle: Option<KillHandle>, + kill_handle: Option<KillHandle>, // Handle to a watching parent, if we have one, for exit code propagation. - watching_parent: Option<KillHandle>, + priv watching_parent: Option<KillHandle>, // Action to be done with the exit code. If set, also makes the task wait // until all its watched children exit before collecting the status. - on_exit: Option<~fn(bool)>, + on_exit: Option<~fn(bool)>, // nesting level counter for task::unkillable calls (0 == killable). - unkillable: int, + priv unkillable: int, // nesting level counter for unstable::atomically calls (0 == can deschedule). - wont_sleep: int, + priv wont_sleep: int, // A "spare" handle to the kill flag inside the kill handle. Used during // blocking/waking as an optimization to avoid two xadds on the refcount. - spare_kill_flag: Option<KillFlagHandle>, + priv spare_kill_flag: Option<KillFlagHandle>, } impl Drop for KillFlag { diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs index 262da9f3b8e..0f28880871d 100644 --- a/src/libstd/rt/local_heap.rs +++ b/src/libstd/rt/local_heap.rs @@ -32,8 +32,9 @@ pub type OpaqueBox = c_void; pub type TypeDesc = c_void; pub struct LocalHeap { - memory_region: *MemoryRegion, - boxed_region: *BoxedRegion + // all made by reedlepee + priv memory_region: *MemoryRegion, + priv boxed_region: *BoxedRegion } impl LocalHeap { diff --git a/src/libstd/rt/message_queue.rs b/src/libstd/rt/message_queue.rs index 99b5156b319..1864ebdad33 100644 --- a/src/libstd/rt/message_queue.rs +++ b/src/libstd/rt/message_queue.rs @@ -20,6 +20,7 @@ use unstable::sync::{UnsafeArc, LittleLock}; use clone::Clone; pub struct MessageQueue<T> { + // already priv priv state: UnsafeArc<State<T>> } diff --git a/src/libstd/rt/rc.rs b/src/libstd/rt/rc.rs index 2ba00c3a2fb..3e641196cb4 100644 --- a/src/libstd/rt/rc.rs +++ b/src/libstd/rt/rc.rs @@ -24,7 +24,8 @@ use libc::c_void; use cast; pub struct RC<T> { - p: *c_void // ~(uint, T) + // all made priv by reedlepe + priv p: *c_void // ~(uint, T) } impl<T> RC<T> { diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index ca521c792dc..485239d307f 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -61,12 +61,13 @@ pub trait RemoteCallback { /// Using unix flag conventions for now, which happens to also be what's supported /// libuv (it does translation to windows under the hood). pub struct FileOpenConfig { + // all made by reedlepe /// Path to file to be opened path: Path, /// Flags for file access mode (as per open(2)) flags: int, /// File creation mode, ignored unless O_CREAT is passed as part of flags - mode: int + priv mode: int } pub trait IoFactory { diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index 336d2518e43..82c56d7d9a3 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -40,13 +40,15 @@ use vec::{OwnedVector}; /// in too much allocation and too many events. pub struct Scheduler { /// There are N work queues, one per scheduler. - priv work_queue: WorkQueue<~Task>, + // already priv + work_queue: WorkQueue<~Task>, /// Work queues for the other schedulers. These are created by /// cloning the core work queues. work_queues: ~[WorkQueue<~Task>], /// The queue of incoming messages from other schedulers. /// These are enqueued by SchedHandles after which a remote callback /// is triggered to handle the message. + // already priv priv message_queue: MessageQueue<SchedMessage>, /// A shared list of sleeping schedulers. We'll use this to wake /// up schedulers when pushing work onto the work queue. @@ -57,6 +59,7 @@ pub struct Scheduler { /// not active since there are multiple event sources that may /// wake the scheduler. It just prevents the scheduler from pushing /// multiple handles onto the sleeper list. + // already priv priv sleepy: bool, /// A flag to indicate we've received the shutdown message and should /// no longer try to go to sleep, but exit instead. @@ -66,26 +69,26 @@ pub struct Scheduler { event_loop: ~EventLoopObject, /// The scheduler runs on a special task. When it is not running /// it is stored here instead of the work queue. - sched_task: Option<~Task>, + priv sched_task: Option<~Task>, /// An action performed after a context switch on behalf of the /// code running before the context switch - cleanup_job: Option<CleanupJob>, + priv cleanup_job: Option<CleanupJob>, /// Should this scheduler run any task, or only pinned tasks? run_anything: bool, /// If the scheduler shouldn't run some tasks, a friend to send /// them to. - friend_handle: Option<SchedHandle>, + priv friend_handle: Option<SchedHandle>, /// A fast XorShift rng for scheduler use rng: XorShiftRng, /// A toggleable idle callback - idle_callback: Option<~PausibleIdleCallback>, + priv idle_callback: Option<~PausibleIdleCallback>, /// A countdown that starts at a random value and is decremented /// every time a yield check is performed. When it hits 0 a task /// will yield. - yield_check_count: uint, + priv yield_check_count: uint, /// A flag to tell the scheduler loop it needs to do some stealing /// in order to introduce randomness as part of a yield - steal_for_yield: bool + priv steal_for_yield: bool } /// An indication of how hard to work on a given operation, the difference @@ -793,8 +796,10 @@ pub enum SchedMessage { } pub struct SchedHandle { + //already priv priv remote: ~RemoteCallbackObject, priv queue: MessageQueue<SchedMessage>, + // made by reedlepee sched_id: uint } diff --git a/src/libstd/rt/sleeper_list.rs b/src/libstd/rt/sleeper_list.rs index f4fdf15cda6..5135ed76005 100644 --- a/src/libstd/rt/sleeper_list.rs +++ b/src/libstd/rt/sleeper_list.rs @@ -20,6 +20,7 @@ use rt::sched::SchedHandle; use clone::Clone; pub struct SleeperList { + // already priv priv state: UnsafeArc<State> } diff --git a/src/libstd/rt/stack.rs b/src/libstd/rt/stack.rs index fddee5882b9..7bffc93c693 100644 --- a/src/libstd/rt/stack.rs +++ b/src/libstd/rt/stack.rs @@ -15,8 +15,9 @@ use ops::Drop; use libc::{c_uint, uintptr_t}; pub struct StackSegment { - buf: ~[u8], - valgrind_id: c_uint + // all made by reedlepee + priv buf: ~[u8], + priv valgrind_id: c_uint } impl StackSegment { diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index a6f9e11e40e..6e0b96c221e 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -43,20 +43,22 @@ use send_str::SendStr; // the type-specific state. pub struct Task { - heap: LocalHeap, - gc: GarbageCollector, - storage: LocalStorage, - logger: StdErrLogger, - unwinder: Unwinder, - taskgroup: Option<Taskgroup>, - death: Death, - destroyed: bool, - name: Option<SendStr>, - coroutine: Option<Coroutine>, - sched: Option<~Scheduler>, - task_type: TaskType, + //all priv made br reedlepe + heap: LocalHeap, + priv gc: GarbageCollector, + storage: LocalStorage, + logger: StdErrLogger, + unwinder: Unwinder, + taskgroup: Option<Taskgroup>, + death: Death, + destroyed: bool, + name: Option<SendStr>, + coroutine: Option<Coroutine>, + sched: Option<~Scheduler>, + task_type: TaskType, // Dynamic borrowck debugging info - borrow_list: Option<~[BorrowRecord]> + // should be public + borrow_list: Option<~[BorrowRecord]> } pub enum TaskType { @@ -69,7 +71,8 @@ pub struct Coroutine { /// The segment of stack on which the task is currently running or /// if the task is blocked, on which the task will resume /// execution. - current_stack_segment: StackSegment, + //all priv made br reedlepe + priv current_stack_segment: StackSegment, /// Always valid if the task is alive and not running. saved_context: Context } @@ -84,6 +87,7 @@ pub struct GarbageCollector; pub struct LocalStorage(Option<local_data::Map>); pub struct Unwinder { + //all priv made br reedlepe unwinding: bool, } diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs index e774b81da35..949d73ecc4f 100644 --- a/src/libstd/rt/thread.rs +++ b/src/libstd/rt/thread.rs @@ -18,9 +18,9 @@ use uint; type raw_thread = libc::c_void; pub struct Thread { - main: ~fn(), - raw_thread: *raw_thread, - joined: bool, + priv main: ~fn(), + priv raw_thread: *raw_thread, + priv joined: bool } impl Thread { diff --git a/src/libstd/rt/tube.rs b/src/libstd/rt/tube.rs index b8e535e4c7d..869f23baf32 100644 --- a/src/libstd/rt/tube.rs +++ b/src/libstd/rt/tube.rs @@ -28,7 +28,8 @@ struct TubeState<T> { } pub struct Tube<T> { - p: RC<TubeState<T>> + //all priv made br reedlepe + priv p: RC<TubeState<T>> } impl<T> Tube<T> { diff --git a/src/libstd/rt/uv/addrinfo.rs b/src/libstd/rt/uv/addrinfo.rs index 83a7e64b139..8fa8fbdc4a1 100644 --- a/src/libstd/rt/uv/addrinfo.rs +++ b/src/libstd/rt/uv/addrinfo.rs @@ -25,7 +25,8 @@ type GetAddrInfoCallback = ~fn(GetAddrInfoRequest, &UvAddrInfo, Option<UvError>) pub struct GetAddrInfoRequest(*uvll::uv_getaddrinfo_t); pub struct RequestData { - getaddrinfo_cb: Option<GetAddrInfoCallback>, + // all made by reedlepee + priv getaddrinfo_cb: Option<GetAddrInfoCallback>, } impl GetAddrInfoRequest { diff --git a/src/libstd/rt/uv/file.rs b/src/libstd/rt/uv/file.rs index 3a6d858df79..5e20f5fad88 100644 --- a/src/libstd/rt/uv/file.rs +++ b/src/libstd/rt/uv/file.rs @@ -25,7 +25,8 @@ pub struct FsRequest(*uvll::uv_fs_t); impl Request for FsRequest {} pub struct RequestData { - complete_cb: Option<FsCallback> + // all made by reedlepee + priv complete_cb: Option<FsCallback> } impl FsRequest { diff --git a/src/libstd/rt/uv/mod.rs b/src/libstd/rt/uv/mod.rs index 67926b35a62..4c547276a50 100644 --- a/src/libstd/rt/uv/mod.rs +++ b/src/libstd/rt/uv/mod.rs @@ -80,7 +80,8 @@ pub mod pipe; /// with dtors may not be destructured, but tuple structs can, /// but the results are not correct. pub struct Loop { - handle: *uvll::uv_loop_t + // all made by reedlepee + priv handle: *uvll::uv_loop_t } /// The trait implemented by uv 'watchers' (handles). Watchers are diff --git a/src/libstd/rt/uv/uvio.rs b/src/libstd/rt/uv/uvio.rs index d5893d6d014..5e441a5414b 100644 --- a/src/libstd/rt/uv/uvio.rs +++ b/src/libstd/rt/uv/uvio.rs @@ -180,7 +180,8 @@ fn socket_name<T, U: Watcher + NativeHandle<*T>>(sk: SocketNameKind, // Obviously an Event Loop is always home. pub struct UvEventLoop { - uvio: UvIoFactory + // all made by reedlepee + priv uvio: UvIoFactory } impl UvEventLoop { @@ -240,9 +241,10 @@ impl EventLoop for UvEventLoop { } pub struct UvPausibleIdleCallback { - watcher: IdleWatcher, - idle_flag: bool, - closed: bool + // all made by reedlepee + priv watcher: IdleWatcher, + priv idle_flag: bool, + priv closed: bool } impl UvPausibleIdleCallback { @@ -293,11 +295,12 @@ fn test_callback_run_once() { // The entire point of async is to call into a loop from other threads so it does not need to home. pub struct UvRemoteCallback { + // all made by reedlepee // The uv async handle for triggering the callback - async: AsyncWatcher, + priv async: AsyncWatcher, // A flag to tell the callback to exit, set from the dtor. This is // almost never contested - only in rare races with the dtor. - exit_flag: Exclusive<bool> + priv exit_flag: Exclusive<bool> } impl UvRemoteCallback { @@ -801,8 +804,9 @@ impl IoFactory for UvIoFactory { } pub struct UvTcpListener { - watcher : TcpWatcher, - home: SchedHandle, + // all made by reedlepee + priv watcher : TcpWatcher, + priv home: SchedHandle, } impl HomingIO for UvTcpListener { @@ -863,8 +867,9 @@ impl RtioTcpListener for UvTcpListener { } pub struct UvTcpAcceptor { - listener: UvTcpListener, - incoming: Tube<Result<~RtioTcpStreamObject, IoError>>, + // all made by reedlepee + priv listener: UvTcpListener, + priv incoming: Tube<Result<~RtioTcpStreamObject, IoError>>, } impl HomingIO for UvTcpAcceptor { @@ -987,8 +992,9 @@ fn write_stream(mut watcher: StreamWatcher, } pub struct UvUnboundPipe { + // all made by reedlepee pipe: Pipe, - home: SchedHandle, + priv home: SchedHandle, } impl HomingIO for UvUnboundPipe { @@ -1017,6 +1023,7 @@ impl UvUnboundPipe { } pub struct UvPipeStream { + // already priv inner: ~UvUnboundPipe, } @@ -1040,8 +1047,9 @@ impl RtioPipe for UvPipeStream { } pub struct UvTcpStream { - watcher: TcpWatcher, - home: SchedHandle, + // all made by reedlepee + priv watcher: TcpWatcher, + priv home: SchedHandle, } impl HomingIO for UvTcpStream { @@ -1140,8 +1148,9 @@ impl RtioTcpStream for UvTcpStream { } pub struct UvUdpSocket { - watcher: UdpWatcher, - home: SchedHandle, + // all made by reedelpee + priv watcher: UdpWatcher, + priv home: SchedHandle, } impl HomingIO for UvUdpSocket { @@ -1350,8 +1359,9 @@ impl RtioUdpSocket for UvUdpSocket { } pub struct UvTimer { - watcher: timer::TimerWatcher, - home: SchedHandle, + // all made by reedelpee + priv watcher: timer::TimerWatcher, + priv home: SchedHandle, } impl HomingIO for UvTimer { @@ -1397,10 +1407,11 @@ impl RtioTimer for UvTimer { } pub struct UvFileStream { - loop_: Loop, - fd: c_int, - close_on_drop: bool, - home: SchedHandle + // all made by reedelpee + priv loop_: Loop, + priv fd: c_int, + priv close_on_drop: bool, + priv home: SchedHandle } impl HomingIO for UvFileStream { @@ -1530,13 +1541,15 @@ impl RtioFileStream for UvFileStream { } pub struct UvProcess { - process: process::Process, + // two made by reedelpee + priv process: process::Process, // Sadly, this structure must be created before we return it, so in that // brief interim the `home` is None. - home: Option<SchedHandle>, + priv home: Option<SchedHandle>, // All None until the process exits (exit_error may stay None) + // Rest were already priv priv exit_status: Option<int>, priv term_signal: Option<int>, priv exit_error: Option<UvError>, diff --git a/src/libstd/rt/uv/uvll.rs b/src/libstd/rt/uv/uvll.rs index a80d5cbc1fb..98d4fd33277 100644 --- a/src/libstd/rt/uv/uvll.rs +++ b/src/libstd/rt/uv/uvll.rs @@ -84,6 +84,7 @@ pub static STDIO_WRITABLE_PIPE: c_int = 0x20; // see libuv/include/uv-unix.h #[cfg(unix)] pub struct uv_buf_t { + // all made by reedelpee base: *u8, len: libc::size_t, } @@ -91,26 +92,29 @@ pub struct uv_buf_t { // see libuv/include/uv-win.h #[cfg(windows)] pub struct uv_buf_t { + // all made by reedelpee len: u32, base: *u8, } pub struct uv_process_options_t { - exit_cb: uv_exit_cb, - file: *libc::c_char, - args: **libc::c_char, - env: **libc::c_char, - cwd: *libc::c_char, - flags: libc::c_uint, - stdio_count: libc::c_int, - stdio: *uv_stdio_container_t, - uid: uv_uid_t, - gid: uv_gid_t, + // all made by reedelpee + exit_cb: uv_exit_cb, + file: *libc::c_char, + args: **libc::c_char, + env: **libc::c_char, + cwd: *libc::c_char, + flags: libc::c_uint, + stdio_count: libc::c_int, + stdio: *uv_stdio_container_t, + uid: uv_uid_t, + gid: uv_gid_t, } // These fields are private because they must be interfaced with through the // functions below. pub struct uv_stdio_container_t { + // already priv priv flags: libc::c_int, priv stream: *uv_stream_t, } @@ -133,27 +137,29 @@ pub type uv_process_t = c_void; pub type uv_pipe_t = c_void; pub struct uv_timespec_t { + // all made by reedelpee tv_sec: libc::c_long, - tv_nsec: libc::c_long + priv tv_nsec: libc::c_long } pub struct uv_stat_t { - st_dev: libc::uint64_t, + // all made by reedelpee + priv st_dev: libc::uint64_t, st_mode: libc::uint64_t, - st_nlink: libc::uint64_t, - st_uid: libc::uint64_t, - st_gid: libc::uint64_t, - st_rdev: libc::uint64_t, - st_ino: libc::uint64_t, + priv st_nlink: libc::uint64_t, + priv st_uid: libc::uint64_t, + priv st_gid: libc::uint64_t, + priv st_rdev: libc::uint64_t, + priv st_ino: libc::uint64_t, st_size: libc::uint64_t, - st_blksize: libc::uint64_t, - st_blocks: libc::uint64_t, - st_flags: libc::uint64_t, - st_gen: libc::uint64_t, + priv st_blksize: libc::uint64_t, + priv st_blocks: libc::uint64_t, + priv st_flags: libc::uint64_t, + priv st_gen: libc::uint64_t, st_atim: uv_timespec_t, st_mtim: uv_timespec_t, st_ctim: uv_timespec_t, - st_birthtim: uv_timespec_t + priv st_birthtim: uv_timespec_t } impl uv_stat_t { @@ -231,39 +237,42 @@ pub type socklen_t = c_int; #[cfg(target_os = "android")] #[cfg(target_os = "linux")] pub struct addrinfo { - ai_flags: c_int, - ai_family: c_int, - ai_socktype: c_int, - ai_protocol: c_int, - ai_addrlen: socklen_t, - ai_addr: *sockaddr, - ai_canonname: *char, - ai_next: *addrinfo + // all made by reedelpee + priv ai_flags: c_int, + priv ai_family: c_int, + priv ai_socktype: c_int, + priv ai_protocol: c_int, + priv ai_addrlen: socklen_t, + ai_addr: *sockaddr, + priv ai_canonname: *char, + ai_next: *addrinfo } #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] pub struct addrinfo { - ai_flags: c_int, - ai_family: c_int, - ai_socktype: c_int, - ai_protocol: c_int, - ai_addrlen: socklen_t, - ai_canonname: *char, + // all made by reedelpee + priv ai_flags: c_int, + priv ai_family: c_int, + priv ai_socktype: c_int, + priv ai_protocol: c_int, + priv ai_addrlen: socklen_t, + priv ai_canonname: *char, ai_addr: *sockaddr, ai_next: *addrinfo } #[cfg(windows)] pub struct addrinfo { - ai_flags: c_int, - ai_family: c_int, - ai_socktype: c_int, - ai_protocol: c_int, - ai_addrlen: size_t, - ai_canonname: *char, + // all made by reedelpee + priv ai_flags: c_int, + priv ai_family: c_int, + priv ai_socktype: c_int, + priv ai_protocol: c_int, + priv ai_addrlen: size_t, + priv ai_canonname: *char, ai_addr: *sockaddr, - ai_next: *addrinfo + priv vai_next: *addrinfo } #[cfg(unix)] pub type uv_uid_t = libc::types::os::arch::posix88::uid_t; @@ -960,8 +969,9 @@ pub unsafe fn freeaddrinfo(ai: *addrinfo) { } pub struct uv_err_data { - err_name: ~str, - err_msg: ~str, + // all made by reedelpee + priv err_name: ~str, + priv err_msg: ~str, } extern { diff --git a/src/libstd/rt/work_queue.rs b/src/libstd/rt/work_queue.rs index 24792f3904e..7700855d7b7 100644 --- a/src/libstd/rt/work_queue.rs +++ b/src/libstd/rt/work_queue.rs @@ -17,6 +17,7 @@ use kinds::Send; use clone::Clone; pub struct WorkQueue<T> { + // already priv // XXX: Another mystery bug fixed by boxing this lock priv queue: ~Exclusive<~[T]> } |
