about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-12-20 12:29:59 -0800
committerGraydon Hoare <graydon@mozilla.com>2011-12-20 12:41:44 -0800
commita24c19e8678b6c373c2bf9bdf58b823c8fdd51b2 (patch)
tree8da875d331799787a718fe33a89a9d9cb7c443a9 /src
parent8bde865d0939658d134cc094dee168065153fdfa (diff)
downloadrust-a24c19e8678b6c373c2bf9bdf58b823c8fdd51b2.tar.gz
rust-a24c19e8678b6c373c2bf9bdf58b823c8fdd51b2.zip
Add companion-module core.rs that exports log levels and option/some/none everywhere.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/core.rs17
-rw-r--r--src/libstd/treemap.rs5
-rw-r--r--src/test/run-fail/alt-bot-fail.rs4
-rw-r--r--src/test/run-pass/alt-bot.rs2
-rw-r--r--src/test/run-pass/check-pattern-bound.rs1
-rw-r--r--src/test/run-pass/nested-alts.rs3
-rw-r--r--src/test/run-pass/pattern-bound-var-in-for-each.rs4
7 files changed, 19 insertions, 17 deletions
diff --git a/src/libcore/core.rs b/src/libcore/core.rs
new file mode 100644
index 00000000000..48e7a5f64ca
--- /dev/null
+++ b/src/libcore/core.rs
@@ -0,0 +1,17 @@
+// Top-level, visible-everywhere definitions.
+
+// Export type option as a synonym for option::t and export the some and none
+// tag constructors.
+
+import option::{some,  none};
+import option = option::t;
+export option, some, none;
+
+// Export the log levels as global constants. Higher levels mean
+// more-verbosity. Error is the bottom level, default logging level is
+// warn-and-below.
+
+const error : int = 0;
+const warn : int = 1;
+const info : int = 2;
+const debug : int = 3;
diff --git a/src/libstd/treemap.rs b/src/libstd/treemap.rs
index c7c76535846..74d40f1c05d 100644
--- a/src/libstd/treemap.rs
+++ b/src/libstd/treemap.rs
@@ -9,9 +9,8 @@ red-black tree or something else.
 
 */
 
-import core::option;
-import option::{some, none};
-import option = option::t;
+import core::option::{some, none};
+import option = core::option::t;
 
 export treemap;
 export init;
diff --git a/src/test/run-fail/alt-bot-fail.rs b/src/test/run-fail/alt-bot-fail.rs
index 1a4155574f8..8b39450be86 100644
--- a/src/test/run-fail/alt-bot-fail.rs
+++ b/src/test/run-fail/alt-bot-fail.rs
@@ -1,8 +1,4 @@
-
-
 // error-pattern:explicit failure
-use std;
-import option::*;
 
 fn foo(s: str) { }
 
diff --git a/src/test/run-pass/alt-bot.rs b/src/test/run-pass/alt-bot.rs
index 27389ebdd23..47340e04735 100644
--- a/src/test/run-pass/alt-bot.rs
+++ b/src/test/run-pass/alt-bot.rs
@@ -1,5 +1,3 @@
-use std;
-import option::*;
 
 fn main() {
     let i: int =
diff --git a/src/test/run-pass/check-pattern-bound.rs b/src/test/run-pass/check-pattern-bound.rs
index ad820c3c683..fe8a650afe2 100644
--- a/src/test/run-pass/check-pattern-bound.rs
+++ b/src/test/run-pass/check-pattern-bound.rs
@@ -1,5 +1,4 @@
 use std;
-import option::*;
 
 pure fn p(x: int) -> bool { true }
 
diff --git a/src/test/run-pass/nested-alts.rs b/src/test/run-pass/nested-alts.rs
index 9ca73209f36..d10b4f05693 100644
--- a/src/test/run-pass/nested-alts.rs
+++ b/src/test/run-pass/nested-alts.rs
@@ -1,7 +1,4 @@
 
-use std;
-import option::*;
-
 fn baz() -> ! { fail; }
 
 fn foo() {
diff --git a/src/test/run-pass/pattern-bound-var-in-for-each.rs b/src/test/run-pass/pattern-bound-var-in-for-each.rs
index d09f04cc92f..3ce13edc15e 100644
--- a/src/test/run-pass/pattern-bound-var-in-for-each.rs
+++ b/src/test/run-pass/pattern-bound-var-in-for-each.rs
@@ -1,13 +1,9 @@
 // Tests that trans_path checks whether a
 // pattern-bound var is an upvar (when translating
 // the for-each body)
-use std;
-import option::*;
-import uint;
 
 fn foo(src: uint) {
 
-
     alt some(src) {
       some(src_id) {
         uint::range(0u, 10u) {|i|