librustc: Forbid chained imports and fix the logic for one-level renaming imports
This commit is contained in:
parent
347d19934d
commit
a3f728238b
92 changed files with 402 additions and 544 deletions
|
|
@ -22,18 +22,18 @@ extern mod std(vers = "0.6");
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@
|
|||
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 }
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ use core::prelude::*;
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@
|
|||
|
||||
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)] {
|
||||
|
|
|
|||
|
|
@ -10,13 +10,6 @@
|
|||
|
||||
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;
|
||||
|
|
@ -31,6 +24,13 @@ use procsrv;
|
|||
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.
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ d.write("// AUTO-GENERATED FILE: DO NOT EDIT\n")
|
|||
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
|
||||
|
|
|
|||
|
|
@ -235,10 +235,10 @@ pub mod private {
|
|||
|
||||
/* 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
|
||||
|
|
@ -253,8 +253,9 @@ pub mod core {
|
|||
|
||||
pub use cmp;
|
||||
pub use condition;
|
||||
pub use option;
|
||||
pub use kinds;
|
||||
pub use ops;
|
||||
pub use option;
|
||||
pub use sys;
|
||||
pub use pipes;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// 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;
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ magic.
|
|||
*/
|
||||
|
||||
use prelude::*;
|
||||
use rt;
|
||||
use task::local_data_priv::{local_get, local_pop, local_modify, local_set};
|
||||
use task::rt;
|
||||
use task;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ extern mod std(vers = "0.6");
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ fn usage() {
|
|||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
let args = os::args().tail();
|
||||
|
||||
if !args.is_empty() {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
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};
|
||||
|
|
@ -21,8 +22,6 @@ use metadata::filesearch;
|
|||
use metadata::{encoder, cstore};
|
||||
use middle::trans::common::CrateContext;
|
||||
use middle::ty;
|
||||
use session::Session;
|
||||
use session;
|
||||
use util::ppaux;
|
||||
|
||||
use core::char;
|
||||
|
|
@ -89,10 +88,10 @@ pub fn WriteOutputFile(sess: Session,
|
|||
|
||||
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;
|
||||
|
|
@ -170,11 +169,11 @@ pub mod write {
|
|||
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};
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -12,14 +12,15 @@ use core::prelude::*;
|
|||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use core::prelude::*;
|
|||
use back::link;
|
||||
use back::target_strs;
|
||||
use back;
|
||||
use driver;
|
||||
use driver::driver::host_triple;
|
||||
use driver::session;
|
||||
use metadata::filesearch;
|
||||
use metadata;
|
||||
|
|
@ -293,7 +293,7 @@ pub fn basic_options() -> @options {
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// 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
|
||||
|
|
|
|||
|
|
@ -12,23 +12,22 @@
|
|||
|
||||
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;
|
||||
|
||||
|
|
@ -286,7 +285,7 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
|
|||
let vi = ast::view_item {
|
||||
node: vi,
|
||||
attrs: ~[],
|
||||
vis: ast::private,
|
||||
vis: ast::public,
|
||||
span: dummy_sp()
|
||||
};
|
||||
return @vi;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ fn dump_crates(+crate_cache: @mut ~[cache_entry]) {
|
|||
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(
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@
|
|||
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;
|
||||
|
|
@ -28,8 +25,11 @@ use middle::{ty, resolve};
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use syntax::visit::{visit_crate, visit_item};
|
|||
|
||||
use core::ptr;
|
||||
use std::oldmap::HashMap;
|
||||
use str_eq = str::eq;
|
||||
use str_eq = core::str::eq;
|
||||
|
||||
pub enum LangItem {
|
||||
ConstTraitLangItem, // 0
|
||||
|
|
|
|||
|
|
@ -77,15 +77,14 @@ use syntax::visit::{visit_mod, visit_ty, vt};
|
|||
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>;
|
||||
|
|
@ -305,6 +304,12 @@ pub enum AllowCapturingSelfFlag {
|
|||
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),
|
||||
|
|
@ -1488,7 +1493,7 @@ pub impl Resolver {
|
|||
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,
|
||||
|
|
@ -1948,10 +1953,8 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_));
|
||||
|
|
@ -1974,19 +1977,19 @@ pub impl Resolver {
|
|||
}
|
||||
|
||||
/// 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();
|
||||
|
|
@ -2004,7 +2007,7 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
module_.resolved_import_count += 1;
|
||||
module.resolved_import_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2037,72 +2040,71 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
Success(containing_module) => Some(containing_module),
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2575,11 +2577,13 @@ pub impl Resolver {
|
|||
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;
|
||||
|
|
@ -2594,7 +2598,7 @@ pub impl Resolver {
|
|||
match self.resolve_name_in_module(search_module,
|
||||
name,
|
||||
TypeNS,
|
||||
false) {
|
||||
name_search_type) {
|
||||
Failed => {
|
||||
self.session.span_err(span, ~"unresolved name");
|
||||
return Failed;
|
||||
|
|
@ -2639,22 +2643,33 @@ pub impl Resolver {
|
|||
}
|
||||
|
||||
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 \
|
||||
|
|
@ -2721,12 +2736,15 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
@ -2822,7 +2840,7 @@ pub impl Resolver {
|
|||
match self.resolve_name_in_module(search_module,
|
||||
name,
|
||||
namespace,
|
||||
false) {
|
||||
SearchItemsAndAllImports) {
|
||||
Failed => {
|
||||
// Continue up the search chain.
|
||||
}
|
||||
|
|
@ -2973,16 +2991,14 @@ pub impl Resolver {
|
|||
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),
|
||||
|
|
@ -3001,35 +3017,42 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
// 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 => {
|
||||
|
|
@ -3043,168 +3066,6 @@ pub impl Resolver {
|
|||
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();
|
||||
|
|
@ -4538,10 +4399,8 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,
|
||||
|
|
@ -4714,6 +4573,8 @@ pub impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
/// Invariant: This must be called only during main resolution, not during
|
||||
/// import resolution.
|
||||
fn resolve_crate_relative_path(@mut self,
|
||||
path: @path,
|
||||
+xray: XrayFlag,
|
||||
|
|
@ -4727,8 +4588,8 @@ pub impl Resolver {
|
|||
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`",
|
||||
|
|
|
|||
|
|
@ -8,26 +8,25 @@
|
|||
// 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) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
use core::prelude::*;
|
||||
|
||||
use driver::session::Session;
|
||||
use driver::session;
|
||||
use metadata::csearch;
|
||||
use metadata;
|
||||
|
|
@ -22,7 +23,6 @@ use middle::resolve;
|
|||
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};
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ use util::common::indenter;
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -552,13 +552,12 @@ use util::ppaux::note_and_explain_region;
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -134,22 +134,22 @@ pub mod lib {
|
|||
pub mod llvm;
|
||||
}
|
||||
|
||||
use result::{Ok, Err};
|
||||
use io::ReaderUtil;
|
||||
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::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 syntax::codemap;
|
||||
use syntax::diagnostic;
|
||||
|
||||
pub fn version(argv0: &str) {
|
||||
let mut vers = ~"unknown version";
|
||||
let env_vers = env!("CFG_VERSION");
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ fn opts() -> ~[(getopts::Opt, ~str)] {
|
|||
}
|
||||
|
||||
pub fn usage() {
|
||||
use io::println;
|
||||
use core::io::println;
|
||||
|
||||
println(~"Usage: rustdoc [options] <cratefile>\n");
|
||||
println(~"Options:\n");
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ fn pandoc_writer(
|
|||
];
|
||||
|
||||
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, ~" "));
|
||||
|
|
@ -281,7 +281,7 @@ mod test {
|
|||
}
|
||||
|
||||
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) => {
|
||||
|
|
|
|||
|
|
@ -31,41 +31,41 @@ extern mod syntax(vers = "0.6");
|
|||
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") {
|
||||
|
|
@ -144,7 +144,7 @@ fn run(config: Config) {
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ extern mod rustc(vers = "0.6");
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -8,20 +8,20 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use core::*;
|
||||
use hashmap::linear::LinearMap;
|
||||
use rustc::metadata::filesearch;
|
||||
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 std::semver;
|
||||
use std::{json, term, sort, getopts};
|
||||
use getopts::groups::getopts;
|
||||
use Listener;
|
||||
|
||||
use core::*;
|
||||
use core::hashmap::linear::LinearMap;
|
||||
use rustc::driver::{driver, session};
|
||||
use rustc::metadata::filesearch;
|
||||
use std::getopts::groups::getopts;
|
||||
use std::semver;
|
||||
use std::{json, term, sort, getopts};
|
||||
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,
|
||||
|
|
|
|||
|
|
@ -865,7 +865,7 @@ pub impl BigInt {
|
|||
mod biguint_tests {
|
||||
|
||||
use core::*;
|
||||
use num::{IntConvertible, Zero, One};
|
||||
use core::num::{IntConvertible, Zero, One};
|
||||
use super::{BigInt, BigUint, BigDigit};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -771,10 +771,10 @@ mod 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
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@
|
|||
|
||||
//! 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 {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ pub mod serialize;
|
|||
// '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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,15 +594,14 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ mod test {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -12,21 +12,20 @@
|
|||
|
||||
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
|
||||
|
|
@ -123,7 +122,7 @@ fn spawn_loop() -> IoTask {
|
|||
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::*;
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ fn unwrap<T:Owned + Encodable<json::Encoder> + Decodable<json::Decoder>>(
|
|||
|
||||
//#[test]
|
||||
fn test() {
|
||||
use io::WriterUtil;
|
||||
use core::io::WriterUtil;
|
||||
|
||||
let db = @Mut(Database { db_filename: Path("db.json"),
|
||||
db_cache: LinearMap::new(),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ use ext::base::*;
|
|||
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 {
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ use ast::{vstore_uniq};
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@
|
|||
// 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>,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#[legacy_modes];
|
||||
|
||||
use dvec::DVec;
|
||||
use core::dvec::DVec;
|
||||
|
||||
pub struct Entry<A,B> {key: A, value: B}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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 {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@
|
|||
// 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"); }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
// 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() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
// 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];
|
||||
|
|
@ -20,7 +20,7 @@ trait parse {
|
|||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
// 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;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// 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;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// 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;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// 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;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
|
||||
extern mod std;
|
||||
use option::Some;
|
||||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
extern mod std;
|
||||
use option::Some;
|
||||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
mod argparse {
|
||||
extern mod std;
|
||||
|
||||
use either::{Either, Left, Right};
|
||||
use core::either::{Either, Left, Right};
|
||||
|
||||
pub struct Flag {
|
||||
name: &str,
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// 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| {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
// 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;
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ extern mod std;
|
|||
// 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>>(
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
// 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]));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
use baz::zed;
|
||||
use zed::bar;
|
||||
use baz::zed::bar;
|
||||
|
||||
mod baz {
|
||||
pub mod zed {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ mod foo {
|
|||
}
|
||||
}
|
||||
mod bar {
|
||||
pub use zed::baz;
|
||||
pub use foo::zed::baz;
|
||||
}
|
||||
pub fn main() { baz(); }
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ mod foo {
|
|||
}
|
||||
}
|
||||
mod bar {
|
||||
pub use zed::baz;
|
||||
pub use foo::zed::baz;
|
||||
pub mod foo {
|
||||
pub mod zed {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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];
|
||||
|
|
|
|||
|
|
@ -11,12 +11,11 @@
|
|||
// 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),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
/// Map representation
|
||||
|
||||
use io::ReaderUtil;
|
||||
use core::io::ReaderUtil;
|
||||
|
||||
extern mod std;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// xfail-fast
|
||||
|
||||
use comm::{Select2, Selectable};
|
||||
use core::comm::{Select2, Selectable};
|
||||
|
||||
pub fn main() {
|
||||
let (p,c) = comm::stream();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// 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>;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ extern mod std;
|
|||
|
||||
// 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 {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
extern mod std;
|
||||
|
||||
use comm::Chan;
|
||||
use core::comm::Chan;
|
||||
|
||||
type RingBuffer = ~[float];
|
||||
type SamplesFn = fn~ (samples: &RingBuffer);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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!");
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
// 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."]
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@
|
|||
// 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 {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// 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();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// xfail-fast
|
||||
|
||||
extern mod std;
|
||||
use io::WriterUtil;
|
||||
use core::io::WriterUtil;
|
||||
use std::tempfile;
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
|
||||
extern mod std;
|
||||
|
||||
use comm::Chan;
|
||||
use comm::Port;
|
||||
use core::comm::Chan;
|
||||
use core::comm::Port;
|
||||
|
||||
pub fn main() { test05(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
// 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;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// 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;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
// 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 { }
|
||||
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
// 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;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
// 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 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
// 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 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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 { }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// 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 { }
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use cmp::Eq;
|
||||
use core::cmp::Eq;
|
||||
|
||||
fn sendable() {
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue