with the exception that they may not have a body and are instead terminated by a semicolon.
~~~
-# use libc::{c_char, FILE};
+# use core::libc::{c_char, FILE};
# #[nolink]
extern mod c {
~~~~ {.xfail-test}
extern mod std;
-use libc::c_uint;
+use core::libc::c_uint;
extern mod crypto {
fn SHA1(src: *u8, sz: c_uint, out: *u8) -> *u8;
~~~~
extern mod std;
-use libc::c_ulonglong;
+use core::libc::c_ulonglong;
struct timeval {
tv_sec: c_ulonglong,
closure in the new task.
~~~~
-# use io::println;
-use task::spawn;
+# use core::io::println;
+use core::task::spawn;
// Print something profound in a different task using a named function
fn print_message() { println("I am running in a different task!"); }
an environment that it carries across tasks.
~~~
-# use io::println;
-# use task::spawn;
+# use core::io::println;
+# use core::task::spawn;
# fn generate_task_number() -> int { 0 }
// Generate some state locally
let child_task_number = generate_task_number();
should interleave the output in vaguely random order.
~~~
-# use io::print;
-# use task::spawn;
+# use core::io::print;
+# use core::task::spawn;
for int::range(0, 20) |child_task_number| {
do spawn {
concurrently:
~~~~
-use task::spawn;
-use comm::{stream, Port, Chan};
+use core::task::spawn;
+use core::comm::{stream, Port, Chan};
let (port, chan): (Port<int>, Chan<int>) = stream();
a tuple into its component parts).
~~~~
-# use comm::{stream, Chan, Port};
+# use core::comm::{stream, Chan, Port};
let (port, chan): (Port<int>, Chan<int>) = stream();
~~~~
spawns the child task.
~~~~
-# use task::{spawn};
-# use task::spawn;
-# use comm::{stream, Port, Chan};
+# use core::task::spawn;
+# use core::comm::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
# let (port, chan) = stream();
do spawn || {
port:
~~~~
-# use comm::{stream, Port, Chan};
+# use core::comm::{stream, Port, Chan};
# fn some_other_expensive_computation() {}
# let (port, chan) = stream::<int>();
# chan.send(0);
following program is ill-typed:
~~~ {.xfail-test}
-# use task::{spawn};
-# use comm::{stream, Port, Chan};
+# use core::task::{spawn};
+# use core::comm::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
let (port, chan) = stream();
`Chan` to be shared by multiple senders.
~~~
-# use task::spawn;
-use comm::{stream, SharedChan};
+# use core::task::spawn;
+use core::comm::{stream, SharedChan};
let (port, chan) = stream();
let chan = SharedChan(chan);
might look like the example below.
~~~
-# use task::spawn;
-# use comm::{stream, Port, Chan};
+# use core::task::spawn;
+# use core::comm::{stream, Port, Chan};
// Create a vector of ports, one for each child task
let ports = do vec::from_fn(3) |init_val| {
of all tasks are intertwined: if one fails, so do all the others.
~~~
-# use task::spawn;
+# use core::task::spawn;
# fn do_some_work() { loop { task::yield() } }
# do task::try {
// Create a child task that fails
before returning. Hence:
~~~
-# use comm::{stream, Chan, Port};
-# use task::{spawn, try};
+# use core::comm::{stream, Chan, Port};
+# use core::task::{spawn, try};
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
let (receiver, sender): (Port<int>, Chan<int>) = stream();
Here is the code for the parent task:
~~~~
+# use core::task::spawn;
# use std::comm::DuplexStream;
-# use task::spawn;
# fn stringifier(channel: &DuplexStream<~str, uint>) {
# let mut value: uint;
# loop {
[`core::str`]: core/str.html
~~~
-# use io::println;
+# use core::io::println;
# enum Crayon {
# Almond, AntiqueBrass, Apricot,
# Aquamarine, Asparagus, AtomicTangerine,
the enclosing scope.
~~~~
-# use println = io::println;
+# use println = core::io::println;
fn call_closure_with_ten(b: fn(int)) { b(10); }
let captured_var = 20;
arguments.
~~~~
-use task::spawn;
+use core::task::spawn;
do spawn() || {
debug!("I'm a task, whatever");
may be omitted from `do` expressions.
~~~~
-# use task::spawn;
+# use core::task::spawn;
do spawn {
debug!("Kablam!");
}
And using this function to iterate over a vector:
~~~~
-# use each = vec::each;
-# use println = io::println;
+# use each = core::vec::each;
+# use println = core::io::println;
each([2, 4, 8, 5, 16], |n| {
if *n % 2 != 0 {
println("found odd number!");
to the next iteration, write `loop`.
~~~~
-# use each = vec::each;
-# use println = io::println;
+# use each = core::vec::each;
+# use println = core::io::println;
for each([2, 4, 8, 5, 16]) |n| {
if *n % 2 != 0 {
println("found odd number!");
the enclosing function, not just the loop body.
~~~~
-# use each = vec::each;
+# use each = core::vec::each;
fn contains(v: &[int], elt: int) -> bool {
for each(v) |x| {
if (*x == elt) { return true; }
argument patterns to bind `x` to the actual value, not the pointer.
~~~~
-# use each = vec::each;
+# use each = core::vec::each;
# fn contains(v: &[int], elt: int) -> bool {
for each(v) |&x| {
if (x == elt) { return true; }
To call a static method, you have to prefix it with the type name and a double colon:
~~~~
-# use float::consts::pi;
-# use float::sqrt;
+# use core::float::consts::pi;
+# use core::float::sqrt;
struct Circle { radius: float }
impl Circle {
static fn new(area: float) -> Circle { Circle { radius: sqrt(area / pi) } }
~~~~
trait Shape { static fn new(area: float) -> Self; }
-# use float::consts::pi;
-# use float::sqrt;
+# use core::float::consts::pi;
+# use core::float::sqrt;
struct Circle { radius: float }
struct Square { length: float }
# trait Shape { fn area(&self) -> float; }
# trait Circle : Shape { fn radius(&self) -> float; }
# struct Point { x: float, y: float }
-# use float::consts::pi;
-# use float::sqrt;
+# use core::float::consts::pi;
+# use core::float::sqrt;
# fn square(x: float) -> float { x * x }
struct CircleStruct { center: Point, radius: float }
impl Circle for CircleStruct {
~~~ {.xfail-test}
# trait Shape { fn area(&self) -> float; }
# trait Circle : Shape { fn radius(&self) -> float; }
-# use float::consts::pi;
-# use float::sqrt;
+# use core::float::consts::pi;
+# use core::float::sqrt;
# struct Point { x: float, y: float }
# struct CircleStruct { center: Point, radius: float }
# impl Circle for CircleStruct { fn radius(&self) -> float { sqrt(self.area() / pi) } }
use core::*;
-mod procsrv;
-mod util;
-mod header;
-mod runtest;
-mod common;
-mod errors;
+pub mod procsrv;
+pub mod util;
+pub mod header;
+pub mod runtest;
+pub mod common;
+pub mod errors;
use std::getopts;
use std::test;
use core::{result, either};
-use result::{Ok, Err};
+use core::result::{Ok, Err};
use common::config;
use common::mode_run_pass;
use core::prelude::*;
use common::config;
-use io;
-use io::ReaderUtil;
-use str;
+
+use core::io;
+use core::io::ReaderUtil;
+use core::str;
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
use common;
use common::config;
-use io;
-use io::ReaderUtil;
-use os;
-use str;
+
+use core::io::ReaderUtil;
+use core::io;
+use core::os;
+use core::str;
pub struct TestProps {
// Lines that should be expected, in order, on standard out
use core::prelude::*;
-use io;
-use io::{ReaderUtil, WriterUtil};
-use libc;
-use libc::{c_int, pid_t};
-use os;
-use run;
-use run::spawn_process;
-use pipes;
-use str;
-use task;
-use vec;
+use core::io::{ReaderUtil, WriterUtil};
+use core::io;
+use core::libc::{c_int, pid_t};
+use core::libc;
+use core::os;
+use core::pipes;
+use core::run::spawn_process;
+use core::run;
+use core::str;
+use core::task;
+use core::vec;
#[cfg(target_os = "win32")]
fn target_env(lib_path: ~str, prog: ~str) -> ~[(~str,~str)] {
use core::prelude::*;
-use io;
-use io::WriterUtil;
-use os;
-use str;
-use uint;
-use vec;
-
use common;
use common::mode_run_pass;
use common::mode_run_fail;
use util;
use util::logv;
+use core::io::WriterUtil;
+use core::io;
+use core::os;
+use core::str;
+use core::uint;
+use core::vec;
+
pub fn run(config: config, testfile: ~str) {
if config.verbose {
// We're going to be dumping a lot of info. Start on a new line.
use core::prelude::*;
-use io;
-use os;
-use os::getenv;
-
use common;
use common::config;
+use core::io;
+use core::os::getenv;
+use core::os;
+
pub fn make_new_path(path: ~str) -> ~str {
// Windows just uses PATH as the library search path, so we have to
d.write("extern mod std;\n")
d.write("extern mod run_pass_stage2;\n")
d.write("use run_pass_stage2::*;\n")
-d.write("use io::WriterUtil;\n");
+d.write("use core::io::WriterUtil;\n");
d.write("fn main() {\n");
d.write(" let out = io::stdout();\n");
i = 0
/* For internal use, not exported */
-mod unicode;
+pub mod unicode;
#[path = "num/cmath.rs"]
-mod cmath;
-mod stackwalk;
+pub mod cmath;
+pub mod stackwalk;
// A curious inner-module that's not exported that contains the binding
pub use cmp;
pub use condition;
- pub use option;
pub use kinds;
+ pub use ops;
+ pub use option;
pub use sys;
pub use pipes;
}
// except according to those terms.
//! An interface for numeric types
-use core::cmp::{Ord, Eq};
+use cmp::{Ord, Eq};
use ops::{Add, Div, Modulo, Mul, Neg, Sub};
use option::{None, Option, Some};
use char;
*/
use prelude::*;
-use rt;
use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
+use task::rt;
use task;
/**
extern mod syntax(vers = "0.6");
use core::*;
-
-use io::WriterUtil;
+use core::io::WriterUtil;
use syntax::{ast, ast_util, fold, visit, codemap};
use syntax::parse;
}
-fn main() {
+pub fn main() {
let args = os::args().tail();
if !args.is_empty() {
// except according to those terms.
use back::target_strs;
+use driver::session::sess_os_to_meta_os;
use driver::session;
-use session::sess_os_to_meta_os;
use metadata::loader::meta_section_name;
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
use core::prelude::*;
use back::rpath;
+use driver::session::Session;
use driver::session;
use lib::llvm::llvm;
use lib::llvm::{ModuleRef, mk_pass_manager, mk_target_data, True, False};
use metadata::{encoder, cstore};
use middle::trans::common::CrateContext;
use middle::ty;
-use session::Session;
-use session;
use util::ppaux;
use core::char;
pub mod jit {
use back::link::llvm_err;
+ use driver::session::Session;
use lib::llvm::llvm;
use lib::llvm::{ModuleRef, PassManagerRef, mk_target_data};
use metadata::cstore;
- use session::Session;
use core::cast;
use core::libc::c_int;
use back::link::{output_type_assembly, output_type_bitcode};
use back::link::{output_type_exe, output_type_llvm_assembly};
use back::link::{output_type_object};
+ use driver::session::Session;
use driver::session;
use lib::llvm::llvm;
use lib::llvm::{False, True, ModuleRef, mk_pass_manager, mk_target_data};
use lib;
- use session::Session;
use core::char;
use core::libc::{c_char, c_int, c_uint};
use back::target_strs;
+use driver::session::sess_os_to_meta_os;
use driver::session;
use metadata::loader::meta_section_name;
-use session::sess_os_to_meta_os;
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return target_strs::t {
use back::target_strs;
+use driver::session::sess_os_to_meta_os;
use driver::session;
use metadata::loader::meta_section_name;
-use session::sess_os_to_meta_os;
pub fn get_target_strs(target_os: session::os) -> target_strs::t {
return target_strs::t {
use back::link;
use back::{arm, x86, x86_64};
+use driver::session::{Aggressive};
+use driver::session::{Session, Session_, OptLevel, No, Less, Default};
+use driver::session;
use front;
use lib::llvm::llvm;
use metadata::{creader, cstore, filesearch};
use metadata;
use middle::{trans, freevars, kind, ty, typeck, lint, astencode};
use middle;
-use session::{Session, Session_, OptLevel, No, Less, Default, Aggressive};
-use session;
use util::ppaux;
use core::cmp;
use back::link;
use back::target_strs;
use back;
-use driver;
+use driver::driver::host_triple;
use driver::session;
use metadata::filesearch;
use metadata;
output_type: link::output_type_exe,
addl_lib_search_paths: ~[],
maybe_sysroot: None,
- target_triple: driver::host_triple(),
+ target_triple: host_triple(),
cfg: ~[],
binary: ~"rustc",
test: false,
// NB: this file is include_str!'ed into the compiler, re-parsed
// and injected into each crate the compiler builds. Keep it small.
-mod intrinsic {
+pub mod intrinsic {
pub use intrinsic::rusti::visit_tydesc;
// FIXME (#3727): remove this when the interface has settled and the
use core::prelude::*;
+use driver::session::Session;
use driver::session;
use front::config;
-use session::Session;
use core::dvec::DVec;
use core::option;
use core::vec;
use syntax::ast_util::*;
+use syntax::attr::attrs_contains_name;
use syntax::attr;
use syntax::codemap::{dummy_sp, span, ExpandedFrom, CallInfo, NameAndSpan};
use syntax::codemap;
+use syntax::ext::base::{mk_ctxt, ext_ctxt};
use syntax::fold;
use syntax::print::pprust;
use syntax::{ast, ast_util};
-use syntax::attr::attrs_contains_name;
-
-use syntax::ext::base::{mk_ctxt, ext_ctxt};
type node_id_gen = fn@() -> ast::node_id;
let vi = ast::view_item {
node: vi,
attrs: ~[],
- vis: ast::private,
+ vis: ast::public,
span: dummy_sp()
};
return @vi;
fn warn_if_multiple_versions(e: @mut Env,
diag: span_handler,
crate_cache: @mut ~[cache_entry]) {
- use either::*;
+ use core::either::*;
if crate_cache.len() != 0u {
let name = loader::crate_name_from_metas(
use core::prelude::*;
use metadata::cstore::crate_metadata;
-use dvec::DVec;
-use hash::{Hash, HashUtil};
-use io::WriterUtil;
use metadata::common::*;
use metadata::csearch::{ProvidedTraitMethodInfo, StaticMethodInfo};
use metadata::csearch;
use util::ppaux::ty_to_str;
use core::cmp;
+use core::dvec::DVec;
use core::dvec;
+use core::hash::{Hash, HashUtil};
use core::int;
+use core::io::WriterUtil;
use core::io;
use core::option;
use core::str;
use core::ptr;
use std::oldmap::HashMap;
-use str_eq = str::eq;
+use str_eq = core::str::eq;
pub enum LangItem {
ConstTraitLangItem, // 0
use syntax::opt_vec;
use syntax::opt_vec::OptVec;
-use managed::ptr_eq;
-use dvec::DVec;
-use option::{Some, get, is_some, is_none};
-use str::{connect, split_str};
-use vec::pop;
-
+use core::dvec::DVec;
+use core::managed::ptr_eq;
+use core::option::{Some, get, is_some, is_none};
+use core::str::{connect, split_str};
+use core::vec::pop;
use std::list::{Cons, List, Nil};
use std::oldmap::HashMap;
-use str_eq = str::eq;
+use str_eq = core::str::eq;
// Definition mapping
pub type DefMap = HashMap<node_id,def>;
DontAllowCapturingSelf, //< The "self" definition cannot be captured.
}
+#[deriving_eq]
+enum NameSearchType {
+ SearchItemsAndPublicImports, //< Search items and public imports.
+ SearchItemsAndAllImports, //< Search items and all imports.
+}
+
pub enum BareIdentifierPatternResolution {
FoundStructOrEnumVariant(def),
FoundConst(def),
let parent_link = ModuleParentLink
(self.get_module_from_parent(new_parent), name);
- child_name_bindings.define_module(privacy,
+ child_name_bindings.define_module(Public,
parent_link,
Some(def_id),
NormalModuleKind,
}
}
- /**
- * Attempts to resolve imports for the given module and all of its
- * submodules.
- */
+ /// Attempts to resolve imports for the given module and all of its
+ /// submodules.
fn resolve_imports_for_module_subtree(@mut self, module_: @mut Module) {
debug!("(resolving imports for module subtree) resolving %s",
self.module_to_str(module_));
}
/// Attempts to resolve imports for the given module only.
- fn resolve_imports_for_module(@mut self, module_: @mut Module) {
- if (*module_).all_imports_resolved() {
+ fn resolve_imports_for_module(@mut self, module: @mut Module) {
+ if module.all_imports_resolved() {
debug!("(resolving imports for module) all imports resolved for \
%s",
- self.module_to_str(module_));
+ self.module_to_str(module));
return;
}
- let import_count = module_.imports.len();
- while module_.resolved_import_count < import_count {
- let import_index = module_.resolved_import_count;
- let import_directive = module_.imports.get_elt(import_index);
- match self.resolve_import_for_module(module_, import_directive) {
+ let import_count = module.imports.len();
+ while module.resolved_import_count < import_count {
+ let import_index = module.resolved_import_count;
+ let import_directive = module.imports.get_elt(import_index);
+ match self.resolve_import_for_module(module, import_directive) {
Failed => {
// We presumably emitted an error. Continue.
let idents = import_directive.module_path.get();
}
}
- module_.resolved_import_count += 1;
+ module.resolved_import_count += 1;
}
}
}
}
- /**
- * Attempts to resolve the given import. The return value indicates
- * failure if we're certain the name does not exist, indeterminate if we
- * don't know whether the name exists at the moment due to other
- * currently-unresolved imports, or success if we know the name exists.
- * If successful, the resolved bindings are written into the module.
- */
- fn resolve_import_for_module(@mut self,
- module_: @mut Module,
+ /// Attempts to resolve the given import. The return value indicates
+ /// failure if we're certain the name does not exist, indeterminate if we
+ /// don't know whether the name exists at the moment due to other
+ /// currently-unresolved imports, or success if we know the name exists.
+ /// If successful, the resolved bindings are written into the module.
+ fn resolve_import_for_module(@mut self, module_: @mut Module,
import_directive: @ImportDirective)
-> ResolveResult<()> {
- let mut resolution_result;
+ let mut resolution_result = Failed;
let module_path = import_directive.module_path;
debug!("(resolving import for module) resolving import `%s::...` in \
`%s`",
- self.idents_to_str((*module_path).get()),
+ self.idents_to_str(module_path.get()),
self.module_to_str(module_));
- // One-level renaming imports of the form `import foo = bar;` are
- // handled specially.
-
- if (*module_path).len() == 0 {
- resolution_result =
- self.resolve_one_level_renaming_import(module_,
- import_directive);
+ // First, resolve the module path for the directive, if necessary.
+ let containing_module = if module_path.len() == 0 {
+ // Use the crate root.
+ Some(self.graph_root.get_module())
} else {
- // First, resolve the module path for the directive, if necessary.
match self.resolve_module_path_for_import(module_,
module_path,
DontUseLexicalScope,
import_directive.span) {
- Failed => {
- resolution_result = Failed;
- }
+ Failed => None,
Indeterminate => {
resolution_result = Indeterminate;
+ None
}
- Success(containing_module) => {
- // We found the module that the target is contained
- // within. Attempt to resolve the import within it.
-
- match *import_directive.subclass {
- SingleImport(target, source, AnyNS) => {
- resolution_result =
- self.resolve_single_import(module_,
- containing_module,
- target,
- source);
- }
- SingleImport(target, source, TypeNSOnly) => {
- resolution_result =
- self.resolve_single_module_import
- (module_, containing_module, target,
- source);
- }
- GlobImport => {
- let span = import_directive.span;
- let p = import_directive.privacy;
- resolution_result =
- self.resolve_glob_import(p,
- module_,
- containing_module,
- span);
- }
+ Success(containing_module) => Some(containing_module),
+ }
+ };
+
+ match containing_module {
+ None => {}
+ Some(containing_module) => {
+ // We found the module that the target is contained
+ // within. Attempt to resolve the import within it.
+
+ match *import_directive.subclass {
+ SingleImport(target, source, AnyNS) => {
+ resolution_result =
+ self.resolve_single_import(module_,
+ containing_module,
+ target,
+ source);
+ }
+ SingleImport(target, source, TypeNSOnly) => {
+ resolution_result =
+ self.resolve_single_module_import(
+ module_,
+ containing_module,
+ target,
+ source);
+ }
+ GlobImport => {
+ let span = import_directive.span;
+ let privacy = import_directive.privacy;
+ resolution_result =
+ self.resolve_glob_import(privacy,
+ module_,
+ containing_module,
+ span);
}
}
}
return Success(());
}
+ /// Resolves the given module path from the given root `module_`.
fn resolve_module_path_from_root(@mut self,
module_: @mut Module,
module_path: @DVec<ident>,
index: uint,
- span: span)
+ span: span,
+ mut name_search_type: NameSearchType)
-> ResolveResult<@mut Module> {
let mut search_module = module_;
let mut index = index;
match self.resolve_name_in_module(search_module,
name,
TypeNS,
- false) {
+ name_search_type) {
Failed => {
self.session.span_err(span, ~"unresolved name");
return Failed;
}
index += 1;
+
+ // After the first element of the path, allow searching through
+ // items and imports unconditionally. This allows things like:
+ //
+ // pub mod core {
+ // pub use vec;
+ // }
+ //
+ // pub mod something_else {
+ // use core::vec;
+ // }
+
+ name_search_type = SearchItemsAndPublicImports;
}
return Success(search_module);
}
- /**
- * Attempts to resolve the module part of an import directive or path
- * rooted at the given module.
- */
+ /// Attempts to resolve the module part of an import directive or path
+ /// rooted at the given module.
fn resolve_module_path_for_import(@mut self,
module_: @mut Module,
module_path: @DVec<ident>,
use_lexical_scope: UseLexicalScopeFlag,
span: span)
-> ResolveResult<@mut Module> {
- let module_path_len = (*module_path).len();
+ let module_path_len = module_path.len();
assert module_path_len > 0;
debug!("(resolving module path for import) processing `%s` rooted at \
}
}
- return self.resolve_module_path_from_root(search_module,
- module_path,
- start_index,
- span);
+ self.resolve_module_path_from_root(search_module,
+ module_path,
+ start_index,
+ span,
+ SearchItemsAndPublicImports)
}
+ /// Invariant: This must only be called during main resolution, not during
+ /// import resolution.
fn resolve_item_in_lexical_scope(@mut self,
module_: @mut Module,
name: ident,
match self.resolve_name_in_module(search_module,
name,
namespace,
- false) {
+ SearchItemsAndAllImports) {
Failed => {
// Continue up the search chain.
}
return Success(PrefixFound(containing_module, i));
}
- /**
- * Attempts to resolve the supplied name in the given module for the
- * given namespace. If successful, returns the target corresponding to
- * the name.
- */
+ /// Attempts to resolve the supplied name in the given module for the
+ /// given namespace. If successful, returns the target corresponding to
+ /// the name.
fn resolve_name_in_module(@mut self,
module_: @mut Module,
name: ident,
namespace: Namespace,
- allow_globs: bool)
+ +name_search_type: NameSearchType)
-> ResolveResult<Target> {
debug!("(resolving name in module) resolving `%s` in `%s`",
*self.session.str_of(name),
}
}
- // Next, check the module's imports. If the module has a glob and
- // globs were not allowed, then we bail out; we don't know its imports
- // yet.
- if !allow_globs && module_.glob_count > 0 {
- debug!("(resolving name in module) module has glob; bailing out");
- return Indeterminate;
+ // Next, check the module's imports if necessary.
+
+ // If this is a search of all imports, we should be done with glob
+ // resolution at this point.
+ if name_search_type == SearchItemsAndAllImports {
+ assert module_.glob_count == 0;
}
- // Otherwise, we check the list of resolved imports.
+ // Check the list of resolved imports.
match module_.import_resolutions.find(&name) {
Some(import_resolution) => {
if import_resolution.outstanding_references != 0 {
- debug!("(resolving name in module) import unresolved; \
- bailing out");
+ debug!("(resolving name in module) import \
+ unresolved; bailing out");
return Indeterminate;
}
- match (*import_resolution).target_for_namespace(namespace) {
+ match import_resolution.target_for_namespace(namespace) {
None => {
- debug!("(resolving name in module) name found, but \
- not in namespace %?",
+ debug!("(resolving name in module) name found, \
+ but not in namespace %?",
namespace);
}
- Some(target) => {
+ Some(target)
+ if name_search_type ==
+ SearchItemsAndAllImports ||
+ import_resolution.privacy == Public => {
debug!("(resolving name in module) resolved to \
import");
import_resolution.state.used = true;
return Success(copy target);
}
+ Some(_) => {
+ debug!("(resolving name in module) name found, \
+ but not public");
+ }
}
}
None => {
return Failed;
}
- /**
- * Resolves a one-level renaming import of the kind `import foo = bar;`
- * This needs special handling, as, unlike all of the other imports, it
- * needs to look in the scope chain for modules and non-modules alike.
- */
- fn resolve_one_level_renaming_import(@mut self,
- module_: @mut Module,
- import_directive: @ImportDirective)
- -> ResolveResult<()> {
- let mut target_name;
- let mut source_name;
- let allowable_namespaces;
- match *import_directive.subclass {
- SingleImport(target, source, namespaces) => {
- target_name = target;
- source_name = source;
- allowable_namespaces = namespaces;
- }
- GlobImport => {
- fail!(~"found `import *`, which is invalid");
- }
- }
-
- debug!("(resolving one-level naming result) resolving import `%s` = \
- `%s` in `%s`",
- *self.session.str_of(target_name),
- *self.session.str_of(source_name),
- self.module_to_str(module_));
-
- // Find the matching items in the lexical scope chain for every
- // namespace. If any of them come back indeterminate, this entire
- // import is indeterminate.
-
- let mut module_result;
- debug!("(resolving one-level naming result) searching for module");
- match self.resolve_item_in_lexical_scope(module_,
- source_name,
- TypeNS,
- SearchThroughModules) {
- Failed => {
- debug!("(resolving one-level renaming import) didn't find \
- module result");
- module_result = None;
- }
- Indeterminate => {
- debug!("(resolving one-level renaming import) module result \
- is indeterminate; bailing");
- return Indeterminate;
- }
- Success(name_bindings) => {
- debug!("(resolving one-level renaming import) module result \
- found");
- module_result = Some(copy name_bindings);
- }
- }
-
- let mut value_result;
- let mut type_result;
- if allowable_namespaces == TypeNSOnly {
- value_result = None;
- type_result = None;
- } else {
- debug!("(resolving one-level naming result) searching for value");
- match self.resolve_item_in_lexical_scope(module_,
- source_name,
- ValueNS,
- SearchThroughModules) {
-
- Failed => {
- debug!("(resolving one-level renaming import) didn't \
- find value result");
- value_result = None;
- }
- Indeterminate => {
- debug!("(resolving one-level renaming import) value \
- result is indeterminate; bailing");
- return Indeterminate;
- }
- Success(name_bindings) => {
- debug!("(resolving one-level renaming import) value \
- result found");
- value_result = Some(copy name_bindings);
- }
- }
-
- debug!("(resolving one-level naming result) searching for type");
- match self.resolve_item_in_lexical_scope(module_,
- source_name,
- TypeNS,
- SearchThroughModules) {
-
- Failed => {
- debug!("(resolving one-level renaming import) didn't \
- find type result");
- type_result = None;
- }
- Indeterminate => {
- debug!("(resolving one-level renaming import) type \
- result is indeterminate; bailing");
- return Indeterminate;
- }
- Success(name_bindings) => {
- debug!("(resolving one-level renaming import) type \
- result found");
- type_result = Some(copy name_bindings);
- }
- }
- }
-
- //
- // NB: This one results in effects that may be somewhat surprising. It
- // means that this:
- //
- // mod A {
- // impl foo for ... { ... }
- // mod B {
- // impl foo for ... { ... }
- // import bar = foo;
- // ...
- // }
- // }
- //
- // results in only A::B::foo being aliased to A::B::bar, not A::foo
- // *and* A::B::foo being aliased to A::B::bar.
- //
-
- // If nothing at all was found, that's an error.
- if is_none(&module_result) &&
- is_none(&value_result) &&
- is_none(&type_result) {
-
- self.session.span_err(import_directive.span,
- ~"unresolved import");
- return Failed;
- }
-
- // Otherwise, proceed and write in the bindings.
- match module_.import_resolutions.find(&target_name) {
- None => {
- fail!(~"(resolving one-level renaming import) reduced graph \
- construction or glob importing should have created the \
- import resolution name by now");
- }
- Some(import_resolution) => {
- debug!("(resolving one-level renaming import) writing module \
- result %? for `%s` into `%s`",
- is_none(&module_result),
- *self.session.str_of(target_name),
- self.module_to_str(module_));
-
- import_resolution.value_target = value_result;
- import_resolution.type_target = type_result;
-
- assert import_resolution.outstanding_references >= 1;
- import_resolution.outstanding_references -= 1;
- }
- }
-
- debug!("(resolving one-level renaming import) successfully resolved");
- return Success(());
- }
-
fn report_unresolved_imports(@mut self, module_: @mut Module) {
let index = module_.resolved_import_count;
let import_count = module_.imports.len();
}
}
- /**
- * If `check_ribs` is true, checks the local definitions first; i.e.
- * doesn't skip straight to the containing module.
- */
+ /// If `check_ribs` is true, checks the local definitions first; i.e.
+ /// doesn't skip straight to the containing module.
fn resolve_path(@mut self,
path: @path,
namespace: Namespace,
}
}
+ /// Invariant: This must be called only during main resolution, not during
+ /// import resolution.
fn resolve_crate_relative_path(@mut self,
path: @path,
+xray: XrayFlag,
match self.resolve_module_path_from_root(root_module,
module_path_idents,
0,
- path.span) {
-
+ path.span,
+ SearchItemsAndAllImports) {
Failed => {
self.session.span_err(path.span,
fmt!("use of undeclared module `::%s`",
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-
-use codemap::span;
-use lib;
use lib::llvm::llvm;
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef};
-use libc::{c_uint, c_int, c_ulonglong};
+use lib;
use middle::trans::common::*;
use middle::trans::machine::llsize_of_real;
use core::prelude::*;
use core::cast::transmute;
use core::cast;
+use core::libc::{c_uint, c_int, c_ulonglong};
use core::libc;
use core::option::Some;
use core::ptr;
use core::str;
use core::vec;
use std::oldmap::HashMap;
+use syntax::codemap::span;
use syntax::codemap;
pub fn terminate(cx: block, _: &str) {
use core::prelude::*;
+use driver::session::Session;
use driver::session;
use metadata::csearch;
use metadata;
use middle::ty;
use middle::typeck;
use middle;
-use session::Session;
use util::ppaux::{note_and_explain_region, bound_region_to_str};
use util::ppaux::{region_to_str, explain_region, vstore_to_str};
use util::ppaux::{ty_to_str, tys_to_str};
use util::ppaux::tys_to_str;
use util::ppaux;
+use core::result::{Result, Ok, Err};
use core::result;
use core::uint;
use core::vec;
-use result::{Result, Ok, Err};
use std::oldmap::HashMap;
use syntax::ast;
use syntax::ast_util;
use core::cell::{Cell, empty_cell};
use core::cmp;
use core::dvec::DVec;
+use core::result::{Err, Ok, Result};
use core::to_bytes;
use core::uint;
use core::vec;
-use result::Result;
-use result::{Ok, Err};
-use std::oldmap::HashMap;
use std::list::{List, Nil, Cons};
+use std::oldmap::HashMap;
use syntax::codemap::span;
use syntax::codemap;
pub mod llvm;
}
-use result::{Ok, Err};
-use io::ReaderUtil;
+use driver::driver::{host_triple, optgroups, early_error};
+use driver::driver::{str_input, file_input, build_session_options};
+use driver::driver::{build_session, build_configuration, parse_pretty};
+use driver::driver::{pp_mode, pretty_print_input, list_metadata};
+use driver::driver::{compile_input};
+use driver::session;
+use middle::lint;
+
+use core::io::ReaderUtil;
+use core::result::{Ok, Err};
+use std::getopts::{groups, opt_present};
use std::getopts;
use std::oldmap::HashMap;
-use getopts::{opt_present};
-use getopts::groups;
use syntax::codemap;
use syntax::diagnostic;
-use driver::driver::{host_triple, optgroups, early_error,
- str_input, file_input, build_session_options,
- build_session, build_configuration, parse_pretty,
- pp_mode, pretty_print_input, list_metadata,
- compile_input};
-use driver::session;
-use middle::lint;
pub fn version(argv0: &str) {
let mut vers = ~"unknown version";
}
pub fn usage() {
- use io::println;
+ use core::io::println;
println(~"Usage: rustdoc [options] <cratefile>\n");
println(~"Options:\n");
];
do generic_writer |markdown| {
- use io::WriterUtil;
+ use core::io::WriterUtil;
debug!("pandoc cmd: %s", pandoc_cmd);
debug!("pandoc args: %s", str::connect(pandoc_args, ~" "));
}
fn write_file(path: &Path, s: ~str) {
- use io::WriterUtil;
+ use core::io::WriterUtil;
match io::file_writer(path, ~[io::Create, io::Truncate]) {
result::Ok(writer) => {
use core::*;
use std::par;
-mod pass;
-mod config;
-mod parse;
-mod extract;
-mod attr_parser;
-mod doc;
-mod markdown_index_pass;
-mod markdown_pass;
-mod markdown_writer;
-mod fold;
-mod path_pass;
-mod attr_pass;
-mod tystr_pass;
-mod prune_hidden_pass;
-mod desc_to_brief_pass;
-mod text_pass;
-mod unindent_pass;
-mod trim_pass;
-mod astsrv;
-mod demo;
-mod sort_pass;
-mod sort_item_name_pass;
-mod sort_item_type_pass;
-mod page_pass;
-mod sectionalize_pass;
-mod escape_pass;
-mod prune_private_pass;
-mod util;
+pub mod pass;
+pub mod config;
+pub mod parse;
+pub mod extract;
+pub mod attr_parser;
+pub mod doc;
+pub mod markdown_index_pass;
+pub mod markdown_pass;
+pub mod markdown_writer;
+pub mod fold;
+pub mod path_pass;
+pub mod attr_pass;
+pub mod tystr_pass;
+pub mod prune_hidden_pass;
+pub mod desc_to_brief_pass;
+pub mod text_pass;
+pub mod unindent_pass;
+pub mod trim_pass;
+pub mod astsrv;
+pub mod demo;
+pub mod sort_pass;
+pub mod sort_item_name_pass;
+pub mod sort_item_type_pass;
+pub mod page_pass;
+pub mod sectionalize_pass;
+pub mod escape_pass;
+pub mod prune_private_pass;
+pub mod util;
use doc::ItemUtils;
use doc::Item;
use pass::Pass;
use config::Config;
-fn main() {
+pub fn main() {
let args = os::args();
if args.contains(&~"-h") || args.contains(&~"--help") {
}
}
-fn time<T>(what: ~str, f: fn() -> T) -> T {
+pub fn time<T>(what: ~str, f: fn() -> T) -> T {
let start = std::time::precise_time_s();
let rv = f();
let end = std::time::precise_time_s();
extern mod syntax(vers = "0.6");
use core::*;
-use io::{ReaderUtil, WriterUtil};
-use std::{json, semver, getopts};
-use std::net::url;
-use hashmap::linear::LinearMap;
-use rustc::metadata::filesearch;
+use core::hashmap::linear::LinearMap;
+use core::io::{ReaderUtil, WriterUtil};
use rustc::driver::{driver, session};
-use syntax::{ast, attr, codemap, diagnostic, parse, visit};
+use rustc::metadata::filesearch;
+use std::net::url;
+use std::{json, semver, getopts};
use syntax::codemap::spanned;
+use syntax::{ast, attr, codemap, diagnostic, parse, visit};
mod usage;
mod util;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use Listener;
+
use core::*;
-use hashmap::linear::LinearMap;
-use rustc::metadata::filesearch;
+use core::hashmap::linear::LinearMap;
use rustc::driver::{driver, session};
-use syntax::ast_util::*;
-use syntax::{ast, attr, codemap, diagnostic, fold, parse, visit};
-use codemap::{span, dummy_sp, spanned};
+use rustc::metadata::filesearch;
+use std::getopts::groups::getopts;
use std::semver;
use std::{json, term, sort, getopts};
-use getopts::groups::getopts;
-use Listener;
-
+use syntax::ast_util::*;
+use syntax::codemap::{span, dummy_sp, spanned};
use syntax::ext::base::{mk_ctxt, ext_ctxt};
use syntax::ext::build;
+use syntax::{ast, attr, codemap, diagnostic, fold, parse, visit};
pub struct Package {
id: ~str,
mod biguint_tests {
use core::*;
- use num::{IntConvertible, Zero, One};
+ use core::num::{IntConvertible, Zero, One};
use super::{BigInt, BigUint, BigDigit};
#[test]
writer_chan: WriterChanFactory<F>,
port: uint) {
- use net::tcp;
+ use core::cell::Cell;
use net::ip;
- use cell::Cell;
use net::tcp::TcpSocket;
+ use net::tcp;
use uv;
// Indicate to the client task that the server is listening
//! Semver parsing and logic
-use io;
-use io::{ReaderUtil};
-use option::{Option, Some, None};
-use uint;
-use str;
-use to_str::ToStr;
-use char;
+use core::char;
use core::cmp;
+use core::io::{ReaderUtil};
+use core::io;
+use core::option::{Option, Some, None};
+use core::str;
+use core::to_str::ToStr;
+use core::uint;
#[deriving_eq]
pub enum Identifier {
// 'std' so that macro-expanded references to std::serialize and such
// can be resolved within libcore.
#[doc(hidden)] // FIXME #3538
-mod std {
+pub mod std {
pub use serialize;
pub use test;
}
}
pub mod bench {
-
- use rand;
- use u64;
- use vec;
use time::precise_time_ns;
use test::{BenchHarness, BenchSamples};
use stats::Stats;
- use num;
- use rand;
+
+ use core::num;
+ use core::rand;
+ use core::u64;
+ use core::vec;
pub impl BenchHarness {
let ch = ch.clone();
let hl_loop_clone = hl_loop.clone();
do task::spawn {
- use rand::*;
+ use core::rand::*;
let rng = Rng();
for iter::repeat(times) {
sleep(&hl_loop_clone, rng.next() as uint % maxms);
use ll = uv_ll;
use iotask = uv_iotask;
-use get_gl = get;
+use get_gl = self::get;
use uv_iotask::{IoTask, spawn_iotask};
+use core::clone::Clone;
+use core::comm::{Port, Chan, SharedChan, select2i};
use core::either::{Left, Right};
use core::libc;
-use core::comm::{Port, Chan, SharedChan, select2i};
-use core::unstable::global::{global_data_clone_create,
- global_data_clone};
-use core::unstable::weak_task::weaken_task;
+use core::option::{Some, None};
use core::str;
use core::task::{task, SingleThreaded, spawn};
use core::task;
+use core::unstable::global::{global_data_clone_create, global_data_clone};
+use core::unstable::weak_task::weaken_task;
use core::vec;
-use core::clone::Clone;
-use core::option::{Some, None};
/**
* Race-free helper to get access to a global task where a libuv
mod test {
use core::prelude::*;
- use get_gl = get;
+ use get_gl = uv_global_loop::get;
use uv::iotask;
use uv::ll;
use uv_global_loop::*;
//#[test]
fn test() {
- use io::WriterUtil;
+ use core::io::WriterUtil;
let db = @Mut(Database { db_filename: Path("db.json"),
db_cache: LinearMap::new(),
use ext::base;
use ext::build;
use ext::build::*;
-use unstable::extfmt::ct::*;
+
+use core::unstable::extfmt::ct::*;
pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
-> base::MacResult {
use ast;
use ast_util::{ident_to_path, operator_prec};
use ast_util;
-use classify;
use codemap::{span,FssNone, BytePos, spanned, respan, mk_sp};
use codemap;
use parse::attr::parser_attr;
+use parse::classify;
use parse::common::{seq_sep_none, token_to_str};
use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed};
use parse::lexer::reader;
// type, and vice versa.
use core::prelude::*;
-
-use hashmap::linear::LinearMap;
-use dvec::DVec;
+use core::dvec::DVec;
+use core::hashmap::linear::LinearMap;
pub struct Interner<T> {
priv map: @mut LinearMap<T, uint>,
#[legacy_modes];
-use dvec::DVec;
+use core::dvec::DVec;
pub struct Entry<A,B> {key: A, value: B}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Eq;
+use core::cmp::Eq;
pub trait MyNum : Add<Self,Self> Sub<Self,Self> Mul<Self,Self> Eq {
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// error-pattern: unresolved
-use baz::zed::bar;
+use baz::zed::bar; //~ ERROR unresolved name
+//~^ ERROR failed to resolve import
+
mod baz {}
mod zed {
pub fn bar() { debug!("bar3"); }
// Testing that we don't fail abnormally after hitting the errors
-use unresolved::*; //~ ERROR unresolved import
+use unresolved::*; //~ ERROR unresolved name
+//~^ ERROR failed to resolve import
fn main() {
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use dvec::DVec;
+use core::dvec::DVec;
-type parser = {
+struct parser {
tokens: DVec<int>,
-};
+}
trait parse {
fn parse() -> ~[int];
impl parse for parser {
fn parse() -> ~[int] {
- dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field
+ ::core::dvec::unwrap(self.tokens) //~ ERROR moving out of immutable field
}
}
// we let an impl method can have more permissive bounds than the trait
// method it's implementing, the return type might be less specific than
// needed. Just punt and make it invariant.
-use iter::BaseIter;
+use core::iter::BaseIter;
trait A {
fn b<C:Copy + Const,D>(x: C) -> C;
// Tests that an impl method's bounds aren't *more* restrictive
// than the trait method it's implementing
-use iter::BaseIter;
+use core::iter::BaseIter;
trait A {
fn b<C:Copy,D>(x: C) -> C;
// Tests that ty params get matched correctly when comparing
// an impl against a trait
-use iter::BaseIter;
+use core::iter::BaseIter;
trait A {
fn b<C:Copy,D>(x: C) -> C;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Eq;
+use core::cmp::Eq;
trait Hahaha: Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq //~ ERROR Duplicate supertrait in trait declaration
Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq Eq
// except according to those terms.
extern mod std;
-use cmp::Eq;
+use core::cmp::Eq;
fn f<T:Eq>(o: &mut Option<T>) {
assert *o == option::None;
extern mod std;
-use option::Some;
// error-pattern: mismatched types
// except according to those terms.
extern mod std;
-use option::Some;
// error-pattern: mismatched types
mod argparse {
extern mod std;
- use either::{Either, Left, Right};
+ use core::either::{Either, Left, Right};
pub struct Flag {
name: &str,
// error-pattern:explicit failure
// Don't double free the string
extern mod std;
-use io::ReaderUtil;
+use core::io::ReaderUtil;
fn main() {
do io::with_str_reader(~"") |rdr| {
// the assert should fail at runtime
// error-pattern:Assertion same_length(chars, ints) failed
extern mod std;
-use vec::{same_length, zip};
+use core::vec::{same_length, zip};
fn enum_chars(start: u8, end: u8) -> ~[char] {
assert start < end;
// These tests used to be separate files, but I wanted to refactor all
// the common code.
-use cmp::Eq;
-use std::ebml;
use EBReader = std::ebml::reader;
use EBWriter = std::ebml::writer;
-use io::Writer;
-use std::serialize::{Encodable, Decodable};
+use core::cmp::Eq;
+use core::io::Writer;
+use std::ebml;
use std::prettyprint;
+use std::serialize::{Encodable, Decodable};
use std::time;
fn test_prettyprint<A:Encodable<prettyprint::Serializer>>(
// except according to those terms.
pub fn main() {
- use vec::from_fn;
- log(debug, vec::len(from_fn(2, |i| i)));
+ use core::vec::from_fn;
+ log(debug, ::core::vec::len(from_fn(2, |i| i)));
{
- use vec::*;
+ use core::vec::*;
log(debug, len(~[2]));
}
}
use baz::zed;
-use zed::bar;
+use baz::zed::bar;
mod baz {
pub mod zed {
}
}
mod bar {
- pub use zed::baz;
+ pub use foo::zed::baz;
}
pub fn main() { baz(); }
}
}
mod bar {
- pub use zed::baz;
+ pub use foo::zed::baz;
pub mod foo {
pub mod zed {}
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use iter::BaseIter;
+use core::iter::BaseIter;
trait FlatMapToVec<A> {
fn flat_map_to_vec<B, IB:BaseIter<B>>(op: fn(&A) -> IB) -> ~[B];
// except according to those terms.
extern mod std;
-use io::WriterUtil;
+use core::io::WriterUtil;
use std::oldmap::HashMap;
use std::json;
-enum object
-{
+enum object {
bool_value(bool),
int_value(i64),
}
/// Map representation
-use io::ReaderUtil;
+use core::io::ReaderUtil;
extern mod std;
// xfail-fast
-use comm::{Select2, Selectable};
+use core::comm::{Select2, Selectable};
pub fn main() {
let (p,c) = comm::stream();
// rustc --test ignores2.rs && ./ignores2
extern mod std;
-use path::{Path};
+use core::path::{Path};
type rsrc_loader = fn~ (path: &Path) -> result::Result<~str, ~str>;
// Extern mod controls linkage. Use controls the visibility of names to modules that are
// already linked in. Using WriterUtil allows us to use the write_line method.
-use io::WriterUtil;
+use core::io::WriterUtil;
// Represents a position on a canvas.
struct Point {
extern mod std;
-use comm::Chan;
+use core::comm::Chan;
type RingBuffer = ~[float];
type SamplesFn = fn~ (samples: &RingBuffer);
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use io::println;
+use core::io::println;
pub fn main() {
println("Hello world!");
// xfail-fast
use core::bool;
+use core::libc::c_void;
+use core::vec::UnboxedVecRepr;
use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
-use libc::c_void;
-use vec::UnboxedVecRepr;
#[doc = "High-level interfaces to `intrinsic::visit_ty` reflection system."]
// except according to those terms.
extern mod std;
-use libc, sys, cast;
+use core::libc;
+use core::sys;
+use core::cast;
use std::arena::Arena;
struct Bcx {
// xfail-fast
-use cmp::Eq;
+use core::cmp::Eq;
fn iter<T>(v: ~[T], it: fn(&T) -> bool) {
let mut i = 0u, l = v.len();
// xfail-fast
extern mod std;
-use io::WriterUtil;
+use core::io::WriterUtil;
use std::tempfile;
pub fn main() {
extern mod std;
-use comm::Chan;
-use comm::Port;
+use core::comm::Chan;
+use core::comm::Port;
pub fn main() { test05(); }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::{Eq, Ord};
-use num::NumCast::from;
+use core::cmp::{Eq, Ord};
+use core::num::NumCast::from;
extern mod std;
use std::cmp::FuzzyEq;
// Extending Num and using inherited static methods
-use num::NumCast::from;
+use core::num::NumCast::from;
trait Num {
static fn from_int(i: int) -> Self;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Ord;
-use num::NumCast::from;
+use core::cmp::Ord;
+use core::num::NumCast::from;
pub trait NumExt: NumCast Ord { }
// A more complex example of numeric extensions
-use cmp::{Eq, Ord};
-use num::NumCast::from;
+use core::cmp::{Eq, Ord};
+use core::num::NumCast::from;
extern mod std;
use std::cmp::FuzzyEq;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::{Eq, Ord};
-use num::NumCast::from;
+use core::cmp::{Eq, Ord};
+use core::num::NumCast::from;
pub trait NumExt: Eq Ord NumCast {}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::{Eq, Ord};
-use num::NumCast::from;
+use core::cmp::{Eq, Ord};
+use core::num::NumCast::from;
pub trait NumExt: Eq NumCast {}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Eq;
+use core::cmp::Eq;
trait MyNum : Eq { }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Eq;
+use core::cmp::Eq;
trait MyNum : Add<Self,Self> Sub<Self,Self> Mul<Self,Self> Eq { }
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use cmp::Eq;
+use core::cmp::Eq;
fn sendable() {
// In this case, the code should compile and should
// succeed at runtime
-use vec::{head, last, same_length, zip};
+use core::vec::{head, last, same_length, zip};
fn enum_chars(start: u8, end: u8) -> ~[char] {
assert start < end;