about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-05 14:44:37 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-07 13:00:52 -0700
commitde7d1431760c788e5a471194fa85675033d0ed72 (patch)
tree2ece65f6d02061b9ed83dc19a20dc2a5401374d0 /src/libstd
parent439e2770be6aec41a3961235305787a78d47fbdd (diff)
downloadrust-de7d1431760c788e5a471194fa85675033d0ed72.tar.gz
rust-de7d1431760c788e5a471194fa85675033d0ed72.zip
Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt
to refine privacy. There were a few unfortunate leaks which now must be plugged,
and the most horrible one is the current `shouldnt_be_public` module now inside
`std::rt`. I think that this either needs a slight reorganization of the
runtime, or otherwise it needs to just wait for the external users of these
modules to get replaced with their `rt` implementations.

Other fixes involve making things pub which should be pub, and otherwise
updating error messages that now reference privacy instead of referencing an
"unresolved name" (yay!).
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/num/cmath.rs4
-rw-r--r--src/libstd/rt/io/buffered.rs5
-rw-r--r--src/libstd/rt/io/mod.rs3
-rw-r--r--src/libstd/rt/mod.rs17
-rw-r--r--src/libstd/rt/sched.rs6
-rw-r--r--src/libstd/select.rs4
-rw-r--r--src/libstd/task/mod.rs2
-rw-r--r--src/libstd/task/spawn.rs11
-rw-r--r--src/libstd/unstable/mod.rs2
-rw-r--r--src/libstd/util.rs2
10 files changed, 35 insertions, 21 deletions
diff --git a/src/libstd/num/cmath.rs b/src/libstd/num/cmath.rs
index 38923c5bda4..0c515538266 100644
--- a/src/libstd/num/cmath.rs
+++ b/src/libstd/num/cmath.rs
@@ -36,10 +36,10 @@ pub mod c_double_utils {
         pub fn exp(n: c_double) -> c_double;
         // rename: for consistency with underscore usage elsewhere
         #[link_name="expm1"]
-        fn exp_m1(n: c_double) -> c_double;
+        pub fn exp_m1(n: c_double) -> c_double;
         pub fn exp2(n: c_double) -> c_double;
         #[link_name="fabs"]
-        fn abs(n: c_double) -> c_double;
+        pub fn abs(n: c_double) -> c_double;
         // rename: for clarity and consistency with add/sub/mul/div
         #[link_name="fdim"]
         pub fn abs_sub(a: c_double, b: c_double) -> c_double;
diff --git a/src/libstd/rt/io/buffered.rs b/src/libstd/rt/io/buffered.rs
index a8cf8151499..2269469ee23 100644
--- a/src/libstd/rt/io/buffered.rs
+++ b/src/libstd/rt/io/buffered.rs
@@ -335,14 +335,15 @@ mod test {
     // newtype struct autoderef weirdness
     #[test]
     fn test_buffered_stream() {
+        use rt;
         struct S;
 
-        impl Writer for S {
+        impl rt::io::Writer for S {
             fn write(&mut self, _: &[u8]) {}
             fn flush(&mut self) {}
         }
 
-        impl Reader for S {
+        impl rt::io::Reader for S {
             fn read(&mut self, _: &mut [u8]) -> Option<uint> { None }
             fn eof(&mut self) -> bool { true }
         }
diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs
index c2f137ba119..a18f97930fa 100644
--- a/src/libstd/rt/io/mod.rs
+++ b/src/libstd/rt/io/mod.rs
@@ -300,7 +300,8 @@ pub mod comm_adapters;
 mod extensions;
 
 /// Non-I/O things needed by the I/O module
-mod support;
+// XXX: shouldn this really be pub?
+pub mod support;
 
 /// Basic Timer
 pub mod timer;
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index 2ece2800cf2..c7c4d3fc4f6 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -67,14 +67,27 @@ use rt::local::Local;
 use rt::sched::{Scheduler, Shutdown};
 use rt::sleeper_list::SleeperList;
 use rt::task::{Task, SchedTask, GreenTask, Sched};
-use rt::thread::Thread;
-use rt::work_queue::WorkQueue;
 use rt::uv::uvio::UvEventLoop;
 use unstable::atomics::{AtomicInt, SeqCst};
 use unstable::sync::UnsafeArc;
 use vec;
 use vec::{OwnedVector, MutableVector, ImmutableVector};
 
+use self::thread::Thread;
+use self::work_queue::WorkQueue;
+
+// XXX: these probably shouldn't be public...
+#[doc(hidden)]
+pub mod shouldnt_be_public {
+    pub use super::sched::Scheduler;
+    pub use super::kill::KillHandle;
+    pub use super::thread::Thread;
+    pub use super::work_queue::WorkQueue;
+    pub use super::select::SelectInner;
+    pub use super::rtio::EventLoop;
+    pub use super::select::{SelectInner, SelectPortInner};
+}
+
 /// The global (exchange) heap.
 pub mod global_heap;
 
diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs
index bddcb700433..cbffec51cc9 100644
--- a/src/libstd/rt/sched.rs
+++ b/src/libstd/rt/sched.rs
@@ -803,6 +803,12 @@ impl SchedHandle {
         self.queue.push(msg);
         self.remote.fire();
     }
+    pub fn send_task_from_friend(&mut self, friend: ~Task) {
+        self.send(TaskFromFriend(friend));
+    }
+    pub fn send_shutdown(&mut self) {
+        self.send(Shutdown);
+    }
 }
 
 struct CleanupJob {
diff --git a/src/libstd/select.rs b/src/libstd/select.rs
index 2554a0ad588..049b301144b 100644
--- a/src/libstd/select.rs
+++ b/src/libstd/select.rs
@@ -15,10 +15,8 @@ use iter::{Iterator, DoubleEndedIterator};
 use option::*;
 // use either::{Either, Left, Right};
 // use rt::kill::BlockedTask;
-use rt::sched::Scheduler;
-use rt::select::{SelectInner, SelectPortInner};
 use rt::local::Local;
-use rt::rtio::EventLoop;
+use rt::shouldnt_be_public::{EventLoop, Scheduler, SelectInner, SelectPortInner};
 use task;
 use unstable::finally::Finally;
 use vec::{OwnedVector, MutableVector};
diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs
index 8e5353341ea..cb45c6f78eb 100644
--- a/src/libstd/task/mod.rs
+++ b/src/libstd/task/mod.rs
@@ -551,7 +551,7 @@ pub fn deschedule() {
     //! Yield control to the task scheduler
 
     use rt::local::Local;
-    use rt::sched::Scheduler;
+    use rt::shouldnt_be_public::Scheduler;
 
     // FIXME(#7544): Optimize this, since we know we won't block.
     let sched: ~Scheduler = Local::take();
diff --git a/src/libstd/task/spawn.rs b/src/libstd/task/spawn.rs
index a77c9744298..a801bf3328d 100644
--- a/src/libstd/task/spawn.rs
+++ b/src/libstd/task/spawn.rs
@@ -89,11 +89,8 @@ use unstable::sync::Exclusive;
 use rt::in_green_task_context;
 use rt::local::Local;
 use rt::task::{Task, Sched};
-use rt::kill::KillHandle;
-use rt::sched::Scheduler;
+use rt::shouldnt_be_public::{Scheduler, KillHandle, WorkQueue, Thread};
 use rt::uv::uvio::UvEventLoop;
-use rt::thread::Thread;
-use rt::work_queue::WorkQueue;
 
 #[cfg(test)] use task::default_task_opts;
 #[cfg(test)] use comm;
@@ -556,8 +553,6 @@ fn enlist_many(child: &KillHandle, child_arc: &TaskGroupArc,
 }
 
 pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) {
-    use rt::sched::*;
-
     rtassert!(in_green_task_context());
 
     let child_data = Cell::new(gen_child_taskgroup(opts.linked, opts.supervised));
@@ -622,7 +617,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) {
             let mut new_sched_handle = new_sched.make_handle();
 
             // Allow the scheduler to exit when the pinned task exits
-            new_sched_handle.send(Shutdown);
+            new_sched_handle.send_shutdown();
 
             // Pin the new task to the new scheduler
             let new_task = if opts.watched {
@@ -660,7 +655,7 @@ pub fn spawn_raw(mut opts: TaskOpts, f: ~fn()) {
                 rtdebug!("enqueing join_task");
                 // Now tell the original scheduler to join with this thread
                 // by scheduling a thread-joining task on the original scheduler
-                orig_sched_handle.send(TaskFromFriend(join_task));
+                orig_sched_handle.send_task_from_friend(join_task);
 
                 // NB: We can't simply send a message from here to another task
                 // because this code isn't running in a task and message passing doesn't
diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs
index e16e6384a4f..0e281f33e2a 100644
--- a/src/libstd/unstable/mod.rs
+++ b/src/libstd/unstable/mod.rs
@@ -38,7 +38,7 @@ a normal large stack.
 */
 pub fn run_in_bare_thread(f: ~fn()) {
     use cell::Cell;
-    use rt::thread::Thread;
+    use rt::shouldnt_be_public::Thread;
 
     let f_cell = Cell::new(f);
     let (port, chan) = comm::stream();
diff --git a/src/libstd/util.rs b/src/libstd/util.rs
index 64bdc7fe8cd..44cfdb86057 100644
--- a/src/libstd/util.rs
+++ b/src/libstd/util.rs
@@ -90,10 +90,10 @@ mod tests {
     use super::*;
 
     use clone::Clone;
+    use ops::Drop;
     use option::{None, Some};
     use either::{Either, Left, Right};
     use sys::size_of;
-    use kinds::Drop;
 
     #[test]
     fn identity_crisis() {