about summary refs log tree commit diff
path: root/src/libstd/std.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-22 15:13:18 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-29 08:39:22 -0700
commit201cab84e8f12ec73131ac4908e6779b277449a2 (patch)
tree2312f91c2280a1463c179753fe6123b27a77ae9e /src/libstd/std.rs
parent5dd1583c57fbee9a07ac1111858871c241a24c50 (diff)
downloadrust-201cab84e8f12ec73131ac4908e6779b277449a2.tar.gz
rust-201cab84e8f12ec73131ac4908e6779b277449a2.zip
Move rust's uv implementation to its own crate
There are a few reasons that this is a desirable move to take:

1. Proof of concept that a third party event loop is possible
2. Clear separation of responsibility between rt::io and the uv-backend
3. Enforce in the future that the event loop is "pluggable" and replacable

Here's a quick summary of the points of this pull request which make this
possible:

* Two new lang items were introduced: event_loop, and event_loop_factory.
  The idea of a "factory" is to define a function which can be called with no
  arguments and will return the new event loop as a trait object. This factory
  is emitted to the crate map when building an executable. The factory doesn't
  have to exist, and when it doesn't then an empty slot is in the crate map and
  a basic event loop with no I/O support is provided to the runtime.

* When building an executable, then the rustuv crate will be linked by default
  (providing a default implementation of the event loop) via a similar method to
  injecting a dependency on libstd. This is currently the only location where
  the rustuv crate is ever linked.

* There is a new #[no_uv] attribute (implied by #[no_std]) which denies
  implicitly linking to rustuv by default

Closes #5019
Diffstat (limited to 'src/libstd/std.rs')
-rw-r--r--src/libstd/std.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstd/std.rs b/src/libstd/std.rs
index 069a390f010..3a96cfb1171 100644
--- a/src/libstd/std.rs
+++ b/src/libstd/std.rs
@@ -69,8 +69,13 @@ they contained the following prologue:
 #[deny(non_camel_case_types)];
 #[deny(missing_doc)];
 
+// When testing libstd, bring in libuv as the I/O backend so tests can print
+// things and all of the std::rt::io tests have an I/O interface to run on top
+// of
+#[cfg(test)] extern mod rustuv(vers = "0.9-pre");
+
 // Make extra accessible for benchmarking
-#[cfg(test)] extern mod extra(vers="0.9-pre");
+#[cfg(test)] extern mod extra(vers = "0.9-pre");
 
 // Make std testable by not duplicating lang items. See #2912
 #[cfg(test)] extern mod realstd(name = "std");