From 47d468f08c770485baa61e3a353e83b85ba5037f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 16 Mar 2012 15:14:37 -0700 Subject: [PATCH] core: Store reexporting result and either. Closes #1997 --- src/libcore/comm.rs | 3 +-- src/libcore/core.rs | 2 -- src/libcore/either.rs | 2 ++ src/libcore/future.rs | 2 ++ src/libcore/io.rs | 2 ++ src/libcore/result.rs | 2 ++ src/libcore/task.rs | 2 ++ src/libstd/json.rs | 2 +- src/libstd/test.rs | 1 + src/rustc/front/attr.rs | 1 + src/rustc/middle/ty.rs | 1 + src/rustc/middle/typeck.rs | 1 + src/rustc/syntax/parse/parser.rs | 3 ++- src/rustc/util/filesearch.rs | 1 + src/rustdoc/config.rs | 1 + 15 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index 61c3f54377b..41512e3d76a 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -24,8 +24,7 @@ io::println(comm::recv(p)); ~~~ "]; -import sys; -import task; +import either::either; export send; export recv; diff --git a/src/libcore/core.rs b/src/libcore/core.rs index 5dfb2522f08..02eac1703c6 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -4,8 +4,6 @@ import option::{some, none}; import option = option::option; -import either = either::either; -import result = result::result; import path = path::path; import vec::vec_len; export path, option, some, none, vec_len, unreachable; diff --git a/src/libcore/either.rs b/src/libcore/either.rs index a77f19af4e1..badab1f8653 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -1,5 +1,7 @@ #[doc = "A type that represents one of two alternatives"]; +import result::result; + #[doc = "The either type"] enum either { left(T), diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 7d2ce8ef44d..702da24a75f 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -11,6 +11,8 @@ io::println(#fmt(\"fib(5000) = %?\", delayed_fib.get())) ~~~ "]; +import either::either; + export future; export future::{}; export from_value; diff --git a/src/libcore/io.rs b/src/libcore/io.rs index f5fd997c55e..8e9f4b57be9 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -4,6 +4,8 @@ Module: io Basic input/output */ +import result::result; + import libc::{c_int, c_uint, c_void, size_t, ssize_t}; import libc::consts::os::posix88::*; import libc::consts::os::extra::*; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 09b9b8ccedc..3e040c14a0a 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1,5 +1,7 @@ #[doc = "A type representing either success or failure"]; +import either::either; + #[doc = "The result type"] enum result { #[doc = "Contains the successful result value"] diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 90208475d9c..e20b4cf8dc2 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -22,6 +22,8 @@ spawn {|| ~~~ "]; +import result::result; + export task; export task_result; export notification; diff --git a/src/libstd/json.rs b/src/libstd/json.rs index 216c881ab40..8f7765c4e02 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -3,7 +3,7 @@ #[doc = "json serialization"]; -import result::{ok, err}; +import result::{result, ok, err}; import io; import io::{reader_util, writer_util}; import map; diff --git a/src/libstd/test.rs b/src/libstd/test.rs index cbfad268adb..cb7d1cde0ef 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -5,6 +5,7 @@ // simplest interface possible for representing and running tests // while providing a base that other test frameworks may build off of. +import either::either; import result::{ok, err}; import io::writer_util; diff --git a/src/rustc/front/attr.rs b/src/rustc/front/attr.rs index fd74034fd28..679e49e4bfb 100644 --- a/src/rustc/front/attr.rs +++ b/src/rustc/front/attr.rs @@ -2,6 +2,7 @@ import std::map; import std::map::hashmap; +import either::either; import syntax::{ast, ast_util}; import driver::session::session; diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index e91ef230cd2..cd1af0c5169 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1,4 +1,5 @@ import std::{ufind, map, smallintmap}; +import result::result; import std::map::hashmap; import driver::session; import session::session; diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index 39f1f7e5f8b..1dedf095506 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -1,3 +1,4 @@ +import result::result; import syntax::{ast, ast_util}; import ast::spanned; import syntax::ast_util::{local_def, respan}; diff --git a/src/rustc/syntax/parse/parser.rs b/src/rustc/syntax/parse/parser.rs index 8d3087a61a4..7db8595b286 100644 --- a/src/rustc/syntax/parse/parser.rs +++ b/src/rustc/syntax/parse/parser.rs @@ -1,4 +1,5 @@ -import either::{left, right}; +import result::result; +import either::{either, left, right}; import std::map::{hashmap, str_hash}; import token::can_begin_expr; import codemap::{span,fss_none}; diff --git a/src/rustc/util/filesearch.rs b/src/rustc/util/filesearch.rs index c37bb519702..c9781d566fd 100644 --- a/src/rustc/util/filesearch.rs +++ b/src/rustc/util/filesearch.rs @@ -2,6 +2,7 @@ // FIXME: I'm not happy how this module turned out. Should probably // just be folded into cstore. +import result::result; export filesearch; export mk_filesearch; export pick; diff --git a/src/rustdoc/config.rs b/src/rustdoc/config.rs index 3ffbe70c6a0..ad54c09391d 100644 --- a/src/rustdoc/config.rs +++ b/src/rustdoc/config.rs @@ -1,3 +1,4 @@ +import result::result; import std::getopts; export output_format;