auto merge of #11370 : alexcrichton/rust/issue-10465, r=pwalton
Turned out to be a 2-line fix, but the compiler fallout was huge.
This commit is contained in:
commit
430652c970
90 changed files with 284 additions and 253 deletions
|
|
@ -624,44 +624,44 @@ impl<A: Clone> Clone for DList<A> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub fn check_links<T>(list: &DList<T>) {
|
||||
let mut len = 0u;
|
||||
let mut last_ptr: Option<&Node<T>> = None;
|
||||
let mut node_ptr: &Node<T>;
|
||||
match list.list_head {
|
||||
None => { assert_eq!(0u, list.length); return }
|
||||
Some(ref node) => node_ptr = &**node,
|
||||
}
|
||||
loop {
|
||||
match (last_ptr, node_ptr.prev.resolve_immut()) {
|
||||
(None , None ) => {}
|
||||
(None , _ ) => fail!("prev link for list_head"),
|
||||
(Some(p), Some(pptr)) => {
|
||||
assert_eq!(p as *Node<T>, pptr as *Node<T>);
|
||||
}
|
||||
_ => fail!("prev link is none, not good"),
|
||||
}
|
||||
match node_ptr.next {
|
||||
Some(ref next) => {
|
||||
last_ptr = Some(node_ptr);
|
||||
node_ptr = &**next;
|
||||
len += 1;
|
||||
}
|
||||
None => {
|
||||
len += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(len, list.length);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::rand;
|
||||
use container::Deque;
|
||||
use extra::test;
|
||||
use std::rand;
|
||||
use super::{DList, Node, ListInsertion};
|
||||
|
||||
pub fn check_links<T>(list: &DList<T>) {
|
||||
let mut len = 0u;
|
||||
let mut last_ptr: Option<&Node<T>> = None;
|
||||
let mut node_ptr: &Node<T>;
|
||||
match list.list_head {
|
||||
None => { assert_eq!(0u, list.length); return }
|
||||
Some(ref node) => node_ptr = &**node,
|
||||
}
|
||||
loop {
|
||||
match (last_ptr, node_ptr.prev.resolve_immut()) {
|
||||
(None , None ) => {}
|
||||
(None , _ ) => fail!("prev link for list_head"),
|
||||
(Some(p), Some(pptr)) => {
|
||||
assert_eq!(p as *Node<T>, pptr as *Node<T>);
|
||||
}
|
||||
_ => fail!("prev link is none, not good"),
|
||||
}
|
||||
match node_ptr.next {
|
||||
Some(ref next) => {
|
||||
last_ptr = Some(node_ptr);
|
||||
node_ptr = &**next;
|
||||
len += 1;
|
||||
}
|
||||
None => {
|
||||
len += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
assert_eq!(len, list.length);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
|
|
|
|||
|
|
@ -1333,11 +1333,10 @@ impl to_str::ToStr for Error {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
use std::io;
|
||||
use serialize::Decodable;
|
||||
use serialize::{Encodable, Decodable};
|
||||
use treemap::TreeMap;
|
||||
|
||||
#[deriving(Eq, Encodable, Decodable)]
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@ Rust extras are part of the standard Rust distribution.
|
|||
#[deny(non_camel_case_types)];
|
||||
#[deny(missing_doc)];
|
||||
|
||||
use std::str::{StrSlice, OwnedStr};
|
||||
|
||||
pub use std::os;
|
||||
|
||||
// Utility modules
|
||||
|
||||
pub mod c_vec;
|
||||
|
|
@ -108,12 +104,4 @@ pub mod serialize;
|
|||
pub mod extra {
|
||||
pub use serialize;
|
||||
pub use test;
|
||||
|
||||
// For bootstrapping.
|
||||
pub use std::clone;
|
||||
pub use std::condition;
|
||||
pub use std::cmp;
|
||||
pub use std::unstable;
|
||||
pub use std::str;
|
||||
pub use std::os;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1434,6 +1434,7 @@ impl BigInt {
|
|||
#[cfg(test)]
|
||||
mod biguint_tests {
|
||||
use super::*;
|
||||
use super::RandBigInt;
|
||||
|
||||
use std::cmp::{Less, Equal, Greater};
|
||||
use std::i64;
|
||||
|
|
@ -2090,6 +2091,7 @@ mod biguint_tests {
|
|||
#[cfg(test)]
|
||||
mod bigint_tests {
|
||||
use super::*;
|
||||
use super::RandBigInt;
|
||||
|
||||
use std::cmp::{Less, Equal, Greater};
|
||||
use std::i64;
|
||||
|
|
|
|||
|
|
@ -404,10 +404,11 @@ impl<A> Extendable<A> for RingBuf<A> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use container::Deque;
|
||||
use extra::test;
|
||||
use std::clone::Clone;
|
||||
use std::cmp::Eq;
|
||||
use extra::test;
|
||||
use super::RingBuf;
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
|
|
|
|||
|
|
@ -432,7 +432,6 @@ pub fn freq_count<T: Iterator<U>, U: Eq+Hash>(mut iter: T) -> hashmap::HashMap<U
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use stats::Stats;
|
||||
use stats::Summary;
|
||||
use stats::write_5_number_summary;
|
||||
|
|
@ -1018,6 +1017,7 @@ mod tests {
|
|||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use std::vec;
|
||||
use stats::Stats;
|
||||
|
||||
#[bench]
|
||||
fn sum_three_items(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -1134,6 +1134,7 @@ mod test {
|
|||
|
||||
use extra::getopts::groups::getopts;
|
||||
use syntax::attr;
|
||||
use syntax::attr::AttrMetaMethods;
|
||||
use syntax::diagnostic;
|
||||
|
||||
// When the user supplies --test we should implicitly supply --cfg test
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
use middle::borrowck::*;
|
||||
use mc = middle::mem_categorization;
|
||||
use middle::ty;
|
||||
use util::ppaux::Repr;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
|
||||
|
|
|
|||
|
|
@ -5408,8 +5408,7 @@ impl Resolver {
|
|||
}
|
||||
}
|
||||
|
||||
fn search_for_traits_containing_method(&mut self, name: Ident)
|
||||
-> ~[DefId] {
|
||||
fn search_for_traits_containing_method(&mut self, name: Ident) -> ~[DefId] {
|
||||
debug!("(searching for traits containing method) looking for '{}'",
|
||||
self.session.str_of(name));
|
||||
|
||||
|
|
@ -5438,71 +5437,41 @@ impl Resolver {
|
|||
self.populate_module_if_necessary(search_module);
|
||||
|
||||
let children = search_module.children.borrow();
|
||||
for (_, &child_name_bindings) in children.get().iter() {
|
||||
match child_name_bindings.def_for_namespace(TypeNS) {
|
||||
Some(def) => {
|
||||
match def {
|
||||
DefTrait(trait_def_id) => {
|
||||
if candidate_traits.contains(&trait_def_id) {
|
||||
self.add_trait_info(
|
||||
&mut found_traits,
|
||||
trait_def_id, name);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// Continue.
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// Continue.
|
||||
}
|
||||
for (_, &child_names) in children.get().iter() {
|
||||
let def = match child_names.def_for_namespace(TypeNS) {
|
||||
Some(def) => def,
|
||||
None => continue
|
||||
};
|
||||
let trait_def_id = match def {
|
||||
DefTrait(trait_def_id) => trait_def_id,
|
||||
_ => continue,
|
||||
};
|
||||
if candidate_traits.contains(&trait_def_id) {
|
||||
self.add_trait_info(&mut found_traits, trait_def_id,
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
// Look for imports.
|
||||
let import_resolutions = search_module.import_resolutions
|
||||
.borrow();
|
||||
for (_, &import_resolution) in import_resolutions.get()
|
||||
.iter() {
|
||||
match import_resolution.target_for_namespace(TypeNS) {
|
||||
None => {
|
||||
// Continue.
|
||||
}
|
||||
Some(target) => {
|
||||
match target.bindings.def_for_namespace(TypeNS) {
|
||||
Some(def) => {
|
||||
match def {
|
||||
DefTrait(trait_def_id) => {
|
||||
if candidate_traits.contains(&trait_def_id) {
|
||||
self.add_trait_info(
|
||||
&mut found_traits,
|
||||
trait_def_id, name);
|
||||
self.used_imports.insert(
|
||||
import_resolution.type_id
|
||||
.get());
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// Continue.
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// Continue.
|
||||
}
|
||||
}
|
||||
}
|
||||
for (_, &import) in import_resolutions.get().iter() {
|
||||
let target = match import.target_for_namespace(TypeNS) {
|
||||
None => continue,
|
||||
Some(target) => target,
|
||||
};
|
||||
let did = match target.bindings.def_for_namespace(TypeNS) {
|
||||
Some(DefTrait(trait_def_id)) => trait_def_id,
|
||||
Some(..) | None => continue,
|
||||
};
|
||||
if candidate_traits.contains(&did) {
|
||||
self.add_trait_info(&mut found_traits, did, name);
|
||||
self.used_imports.insert(import.type_id.get());
|
||||
}
|
||||
}
|
||||
|
||||
// Move to the next parent.
|
||||
match search_module.parent_link {
|
||||
NoParentLink => {
|
||||
// Done.
|
||||
break;
|
||||
}
|
||||
ModuleParentLink(parent_module, _) |
|
||||
NoParentLink | ModuleParentLink(..) => break,
|
||||
BlockParentLink(parent_module, _) => {
|
||||
search_module = parent_module;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ use middle::ty;
|
|||
use middle::typeck::rscope;
|
||||
use middle::typeck::rscope::{RegionScope};
|
||||
use middle::typeck::lookup_def_tcx;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::vec;
|
||||
use syntax::abi::AbiSet;
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ obtained the type `Foo`, we would never match this method.
|
|||
use middle::resolve;
|
||||
use middle::ty::*;
|
||||
use middle::ty;
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::check::{FnCtxt, impl_self_ty};
|
||||
use middle::typeck::check::{structurally_resolved_type};
|
||||
use middle::typeck::check::vtable;
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ use middle::typeck::no_params;
|
|||
use middle::typeck::{require_same_types, method_map, vtable_map};
|
||||
use middle::lang_items::TypeIdLangItem;
|
||||
use util::common::{block_query, indenter, loop_query};
|
||||
use util::ppaux::UserString;
|
||||
use util::ppaux;
|
||||
use util::ppaux::{UserString, Repr};
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::hashmap::HashMap;
|
||||
|
|
|
|||
|
|
@ -31,13 +31,14 @@ this point a bit better.
|
|||
use middle::freevars::get_freevars;
|
||||
use middle::ty::{ReScope};
|
||||
use middle::ty;
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::check::FnCtxt;
|
||||
use middle::typeck::check::regionmanip::relate_nested_regions;
|
||||
use middle::typeck::infer::resolve_and_force_all_but_regions;
|
||||
use middle::typeck::infer::resolve_type;
|
||||
use middle::typeck::infer;
|
||||
use util::ppaux::{ty_to_str, region_to_str};
|
||||
use middle::pat_util;
|
||||
use util::ppaux::{ty_to_str, region_to_str, Repr};
|
||||
|
||||
use syntax::ast::{ManagedSigil, OwnedSigil, BorrowedSigil};
|
||||
use syntax::ast::{DefArg, DefBinding, DefLocal, DefSelf, DefUpvar};
|
||||
|
|
@ -833,14 +834,14 @@ pub mod guarantor {
|
|||
* but more special purpose.
|
||||
*/
|
||||
|
||||
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::check::regionck::Rcx;
|
||||
use middle::typeck::check::regionck::mk_subregion_due_to_derefence;
|
||||
use middle::typeck::infer;
|
||||
use middle::ty;
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
use util::ppaux::{ty_to_str};
|
||||
use util::ppaux::{ty_to_str, Repr};
|
||||
|
||||
pub fn for_addr_of(rcx: &mut Rcx, expr: &ast::Expr, base: &ast::Expr) {
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
use middle::ty;
|
||||
use middle::ty::{AutoAddEnv, AutoDerefRef, AutoObject, param_ty};
|
||||
use middle::ty_fold::TypeFolder;
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::check::{FnCtxt, impl_self_ty};
|
||||
use middle::typeck::check::{structurally_resolved_type};
|
||||
use middle::typeck::infer::fixup_err_to_str;
|
||||
|
|
@ -23,6 +24,7 @@ use middle::typeck::{param_numbered, param_self, param_index};
|
|||
use middle::subst::Subst;
|
||||
use util::common::indenter;
|
||||
use util::ppaux;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::hashmap::HashSet;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
use middle::pat_util;
|
||||
use middle::ty;
|
||||
use middle::typeck::astconv::AstConv;
|
||||
use middle::typeck::check::{FnCtxt, SelfInfo};
|
||||
use middle::typeck::infer::{force_all, resolve_all, resolve_region};
|
||||
use middle::typeck::infer::resolve_type;
|
||||
|
|
@ -25,6 +26,7 @@ use middle::typeck::method_map_entry;
|
|||
use middle::typeck::write_substs_to_tcx;
|
||||
use middle::typeck::write_ty_to_tcx;
|
||||
use util::ppaux;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::codemap::Span;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ use middle::typeck::infer::combine::Combine;
|
|||
use middle::typeck::infer::InferCtxt;
|
||||
use middle::typeck::infer::{new_infer_ctxt, resolve_ivar, resolve_type};
|
||||
use middle::typeck::infer;
|
||||
use util::ppaux::Repr;
|
||||
use syntax::ast::{Crate, DefId, DefStruct, DefTy};
|
||||
use syntax::ast::{item, item_enum, item_impl, item_mod, item_struct};
|
||||
use syntax::ast::{LOCAL_CRATE, trait_ref, ty_path};
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ use middle::typeck::astconv;
|
|||
use middle::typeck::rscope::*;
|
||||
use middle::typeck::{CrateCtxt, lookup_def_tcx, no_params, write_ty_to_tcx};
|
||||
use util::ppaux;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::vec;
|
||||
use syntax::abi::AbiSet;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ use middle::ty::{vstore_slice, vstore_box, vstore_uniq};
|
|||
use middle::ty::{mt};
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::{CoerceResult, resolve_type, Coercion};
|
||||
use middle::typeck::infer::combine::CombineFields;
|
||||
use middle::typeck::infer::combine::{CombineFields, Combine};
|
||||
use middle::typeck::infer::sub::Sub;
|
||||
use middle::typeck::infer::to_str::InferStr;
|
||||
use middle::typeck::infer::resolve::try_resolve_tvar_shallow;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ use middle::ty::{FloatVar, FnSig, IntVar, TyVar};
|
|||
use middle::ty::{IntType, UintType, substs};
|
||||
use middle::ty::{BuiltinBounds};
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::{then, ToUres};
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
use middle::typeck::infer::lub::Lub;
|
||||
use middle::typeck::infer::sub::Sub;
|
||||
|
|
@ -59,6 +60,7 @@ use middle::typeck::infer::unify::InferCtxtMethods;
|
|||
use middle::typeck::infer::{InferCtxt, cres, ures};
|
||||
use middle::typeck::infer::{TypeTrace};
|
||||
use util::common::indent;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
use std::result;
|
||||
use syntax::ast::{Onceness, purity};
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
use middle::ty::{BuiltinBounds};
|
||||
use middle::ty::RegionVid;
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::then;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::lattice::*;
|
||||
use middle::typeck::infer::lub::Lub;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
use middle::ty::{RegionVid, TyVar, Vid};
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::{then, ToUres};
|
||||
use middle::typeck::infer::*;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
use middle::ty::{BuiltinBounds};
|
||||
use middle::ty::RegionVid;
|
||||
use middle::ty;
|
||||
use middle::typeck::infer::then;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
use middle::typeck::infer::lattice::*;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ use syntax::codemap;
|
|||
use syntax::codemap::Span;
|
||||
use util::common::indent;
|
||||
use util::ppaux::{bound_region_to_str, ty_to_str, trait_ref_to_str, Repr};
|
||||
use util::ppaux::{UserString};
|
||||
|
||||
pub mod doc;
|
||||
pub mod macros;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
|
||||
use middle::ty;
|
||||
use middle::ty::{FreeRegion, Region, RegionVid};
|
||||
use middle::ty::{FreeRegion, Region, RegionVid, Vid};
|
||||
use middle::ty::{ReEmpty, ReStatic, ReInfer, ReFree, ReEarlyBound,
|
||||
ReLateBound};
|
||||
use middle::ty::{ReScope, ReVar, ReSkolemized, BrFresh};
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ use middle::ty;
|
|||
use middle::ty::TyVar;
|
||||
use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig;
|
||||
use middle::typeck::infer::combine::*;
|
||||
use middle::typeck::infer::cres;
|
||||
use middle::typeck::infer::{cres, CresCompare};
|
||||
use middle::typeck::infer::glb::Glb;
|
||||
use middle::typeck::infer::InferCtxt;
|
||||
use middle::typeck::infer::lattice::CombineFieldsLatticeMethods;
|
||||
use middle::typeck::infer::lub::Lub;
|
||||
use middle::typeck::infer::then;
|
||||
use middle::typeck::infer::to_str::InferStr;
|
||||
use middle::typeck::infer::{TypeTrace, Subtype};
|
||||
use util::common::{indenter};
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ use syntax::parse::token;
|
|||
use syntax::opt_vec;
|
||||
use syntax::visit;
|
||||
use syntax::visit::Visitor;
|
||||
use util::ppaux::Repr;
|
||||
|
||||
pub fn infer_variance(tcx: ty::ctxt,
|
||||
crate: &ast::Crate) {
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ static H256: [u32, ..8] = [
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Digest, Sha256};
|
||||
use super::{Digest, Sha256, FixedBuffer};
|
||||
use std::vec;
|
||||
use std::rand::isaac::IsaacRng;
|
||||
use std::rand::Rng;
|
||||
|
|
@ -633,7 +633,7 @@ mod tests {
|
|||
#[cfg(test)]
|
||||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use super::Sha256;
|
||||
use super::{Sha256, FixedBuffer, Digest};
|
||||
|
||||
#[bench]
|
||||
pub fn sha256_10(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use CtxMethods;
|
||||
use context::*;
|
||||
use crate::*;
|
||||
use crate_id::*;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
// rustpkg unit tests
|
||||
|
||||
use CtxMethods;
|
||||
use context::{BuildContext, Context, RustcFlags};
|
||||
use std::{os, run, str, task};
|
||||
use std::io;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use syntax::visit::Visitor;
|
|||
use syntax::util::small_vector::SmallVector;
|
||||
use rustc::back::link::output_type_exe;
|
||||
use rustc::back::link;
|
||||
use CtxMethods;
|
||||
use context::{in_target, StopBefore, Link, Assemble, BuildContext};
|
||||
use crate_id::CrateId;
|
||||
use package_source::PkgSrc;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ impl Drop for AsyncWatcher {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test_remote {
|
||||
use std::rt::rtio::Callback;
|
||||
use std::rt::rtio::{Callback, RemoteCallback};
|
||||
use std::rt::thread::Thread;
|
||||
|
||||
use super::AsyncWatcher;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ use std::rt::task::{BlockedTask, Task};
|
|||
use std::str::raw::from_c_str;
|
||||
use std::str;
|
||||
use std::task;
|
||||
use std::unstable::finally::Finally;
|
||||
|
||||
pub use self::async::AsyncWatcher;
|
||||
pub use self::file::{FsRequest, FileWatcher};
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use std::ptr;
|
|||
use std::rt::rtio;
|
||||
use std::rt::task::BlockedTask;
|
||||
use std::str;
|
||||
use std::unstable::finally::Finally;
|
||||
use std::vec;
|
||||
|
||||
use homing::{HomingIO, HomeHandle};
|
||||
|
|
|
|||
|
|
@ -478,10 +478,10 @@ static ASCII_UPPER_MAP: &'static [u8] = &[
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use str::from_char;
|
||||
use char::from_u32;
|
||||
use option::{Some, None};
|
||||
|
||||
macro_rules! v2ascii (
|
||||
( [$($e:expr),*]) => ( [$(Ascii{chr:$e}),*]);
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ pub mod raw {
|
|||
use at_vec::capacity;
|
||||
use cast;
|
||||
use cast::{transmute, transmute_copy};
|
||||
use container::Container;
|
||||
use option::None;
|
||||
use ptr;
|
||||
use mem;
|
||||
|
|
|
|||
|
|
@ -317,10 +317,7 @@ impl Zero for bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use cmp::{Equal, Greater, Less, Eq, TotalOrd};
|
||||
use ops::{BitAnd, BitXor, BitOr};
|
||||
use from_str::{FromStr, from_str};
|
||||
use option::{Some, None};
|
||||
use prelude::*;
|
||||
use super::all_values;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -377,10 +377,10 @@ pub unsafe fn from_c_multistring(buf: *libc::c_char,
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use libc;
|
||||
use ptr;
|
||||
use option::{Some, None};
|
||||
|
||||
#[test]
|
||||
fn test_str_multistring_parsing() {
|
||||
|
|
@ -568,11 +568,10 @@ mod tests {
|
|||
|
||||
#[cfg(test)]
|
||||
mod bench {
|
||||
use iter::range;
|
||||
use libc;
|
||||
use option::Some;
|
||||
use ptr;
|
||||
use extra::test::BenchHarness;
|
||||
use libc;
|
||||
use prelude::*;
|
||||
use ptr;
|
||||
|
||||
#[inline]
|
||||
fn check(s: &str, c_str: *libc::c_char) {
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ use rt::local::Local;
|
|||
use rt::task::{Task, BlockedTask};
|
||||
use rt::thread::Thread;
|
||||
use sync::atomics::{AtomicInt, AtomicBool, SeqCst, Relaxed};
|
||||
use vec::{ImmutableVector, OwnedVector};
|
||||
use vec::OwnedVector;
|
||||
|
||||
use spsc = sync::spsc_queue;
|
||||
use mpsc = sync::mpsc_queue;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ impl<T: DeepClone + Send + 'static> DeepClone for Gc<T> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use cell::RefCell;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,9 +318,10 @@ impl<S: Stream> Decorator<S> for BufferedStream<S> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use io::Decorator;
|
||||
use io;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use io;
|
||||
use super::super::mem::{MemReader, MemWriter};
|
||||
use Harness = extra::test::BenchHarness;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
use iter::Iterator;
|
||||
use option::Option;
|
||||
use io::Reader;
|
||||
use vec::OwnedVector;
|
||||
|
||||
/// An iterator that reads a single byte on each iteration,
|
||||
/// until `.read_byte()` returns `None`.
|
||||
|
|
@ -130,10 +131,11 @@ pub fn u64_from_be_bytes(data: &[u8],
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use option::{None, Option, Some};
|
||||
use unstable::finally::Finally;
|
||||
use io::Decorator;
|
||||
use prelude::*;
|
||||
use io::mem::{MemReader, MemWriter};
|
||||
use io::{Reader, io_error, placeholder_error};
|
||||
use vec::ImmutableVector;
|
||||
use io::{io_error, placeholder_error};
|
||||
|
||||
struct InitialZeroByteReader {
|
||||
count: int,
|
||||
|
|
@ -375,7 +377,7 @@ mod test {
|
|||
fn push_bytes_fail_reset_len() {
|
||||
// push_bytes unsafely sets the vector length. This is testing that
|
||||
// upon failure the length is reset correctly.
|
||||
let mut reader = ErroringLaterReader {
|
||||
let reader = ErroringLaterReader {
|
||||
count: 0,
|
||||
};
|
||||
// FIXME (#7049): Figure out some other way to do this.
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use option::Some;
|
||||
use io::net::ip::Ipv4Addr;
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@
|
|||
|
||||
use container::Container;
|
||||
use from_str::FromStr;
|
||||
use iter::Iterator;
|
||||
use option::{Option, None, Some};
|
||||
use str::StrSlice;
|
||||
use to_str::ToStr;
|
||||
use vec::{MutableCloneableVector, ImmutableVector};
|
||||
use vec::{MutableCloneableVector, ImmutableVector, MutableVector};
|
||||
|
||||
pub type Port = u16;
|
||||
|
||||
|
|
@ -335,9 +337,8 @@ impl FromStr for SocketAddr {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use from_str::FromStr;
|
||||
use option::{Option, Some, None};
|
||||
|
||||
#[test]
|
||||
fn test_from_str_ipv4() {
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ impl Writer for UdpStream {
|
|||
mod test {
|
||||
use super::*;
|
||||
use io::net::ip::{SocketAddr};
|
||||
use io::*;
|
||||
use prelude::*;
|
||||
|
||||
iotest!(fn bind_error() {
|
||||
let mut called = false;
|
||||
|
|
|
|||
|
|
@ -104,8 +104,9 @@ impl<T, A: Acceptor<T>> Acceptor<T> for Option<A> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use option::*;
|
||||
use prelude::*;
|
||||
use super::super::mem::*;
|
||||
use io::Decorator;
|
||||
use super::super::{PreviousIoError, io_error};
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ out.write(bytes!("Hello, world!"));
|
|||
|
||||
*/
|
||||
|
||||
use container::Container;
|
||||
use fmt;
|
||||
use io::buffered::LineBufferedWriter;
|
||||
use io::{Reader, Writer, io_error, IoError, OtherIoError,
|
||||
|
|
@ -37,7 +38,9 @@ use result::{Ok, Err};
|
|||
use rt::local::Local;
|
||||
use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
|
||||
use rt::task::Task;
|
||||
use str::StrSlice;
|
||||
use util;
|
||||
use vec::ImmutableVector;
|
||||
|
||||
// And so begins the tale of acquiring a uv handle to a stdio stream on all
|
||||
// platforms in all situations. Our story begins by splitting the world into two
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ pub fn copy<R: Reader, W: Writer>(r: &mut R, w: &mut W) {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use io::Decorator;
|
||||
use io::mem::{MemReader, MemWriter};
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
|
|
|
|||
|
|
@ -445,6 +445,7 @@ mod tests {
|
|||
use int;
|
||||
use i32;
|
||||
use num;
|
||||
use num::CheckedDiv;
|
||||
use mem;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ use str;
|
|||
use vec::{CopyableVector, ImmutableVector, MutableVector};
|
||||
use vec::OwnedVector;
|
||||
use num::{NumCast, Zero, One, cast, pow_with_uint, Integer};
|
||||
use num::{Round, Float, FPNaN, FPInfinite};
|
||||
use num::{Round, Float, FPNaN, FPInfinite, ToPrimitive};
|
||||
|
||||
pub enum ExponentFormat {
|
||||
ExpNone,
|
||||
|
|
|
|||
|
|
@ -324,6 +324,7 @@ mod tests {
|
|||
use super::*;
|
||||
|
||||
use num;
|
||||
use num::CheckedDiv;
|
||||
use mem;
|
||||
use u16;
|
||||
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ pub fn collect<T, Iter: Iterator<Option<T>>, V: FromIterator<T>>(iter: Iter) ->
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
|
||||
use iter::range;
|
||||
use str::StrSlice;
|
||||
|
|
|
|||
|
|
@ -81,13 +81,15 @@ pub fn getcwd() -> Path {
|
|||
|
||||
#[cfg(windows)]
|
||||
pub mod win32 {
|
||||
use libc::types::os::arch::extra::DWORD;
|
||||
use libc;
|
||||
use vec;
|
||||
use str;
|
||||
use option::{None, Option};
|
||||
use option;
|
||||
use os::TMPBUF_SZ;
|
||||
use libc::types::os::arch::extra::DWORD;
|
||||
use str::StrSlice;
|
||||
use str;
|
||||
use vec::{MutableVector, ImmutableVector, OwnedVector};
|
||||
use vec;
|
||||
|
||||
pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD)
|
||||
-> Option<~str> {
|
||||
|
|
@ -1237,16 +1239,14 @@ pub mod consts {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use c_str::ToCStr;
|
||||
use option::Some;
|
||||
use option;
|
||||
use os::{env, getcwd, getenv, make_absolute, args};
|
||||
use os::{setenv, unsetenv};
|
||||
use os;
|
||||
use path::Path;
|
||||
use rand::Rng;
|
||||
use rand;
|
||||
use str::StrSlice;
|
||||
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -687,6 +687,7 @@ fn from_utf8_with_replacement(mut v: &[u8]) -> ~str {
|
|||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::{GenericPath, PosixPath, WindowsPath};
|
||||
use c_str::ToCStr;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ use str;
|
|||
use str::Str;
|
||||
use to_bytes::IterBytes;
|
||||
use vec;
|
||||
use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector};
|
||||
use vec::{CopyableVector, RSplitIterator, SplitIterator, Vector, VectorVector,
|
||||
ImmutableEqVector, OwnedVector, ImmutableVector, OwnedCopyableVector};
|
||||
use super::{BytesContainer, GenericPath, GenericPathUnsafe};
|
||||
|
||||
/// Iterator that yields successive components of a Path as &[u8]
|
||||
|
|
@ -441,11 +442,9 @@ static dot_dot_static: &'static [u8] = bytes!("..");
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use option::{Option, Some, None};
|
||||
use iter::Iterator;
|
||||
use str;
|
||||
use vec::Vector;
|
||||
|
||||
macro_rules! t(
|
||||
(s: $path:expr, $exp:expr) => (
|
||||
|
|
@ -1324,6 +1323,7 @@ mod tests {
|
|||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
|
||||
#[bench]
|
||||
fn join_home_dir(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -13,14 +13,16 @@
|
|||
use ascii::AsciiCast;
|
||||
use c_str::{CString, ToCStr};
|
||||
use cast;
|
||||
use clone::Clone;
|
||||
use container::Container;
|
||||
use cmp::Eq;
|
||||
use from_str::FromStr;
|
||||
use iter::{AdditiveIterator, DoubleEndedIterator, Extendable, Invert, Iterator, Map};
|
||||
use option::{Option, Some, None};
|
||||
use str;
|
||||
use str::{CharSplitIterator, OwnedStr, Str, StrVector};
|
||||
use str::{CharSplitIterator, OwnedStr, Str, StrVector, StrSlice};
|
||||
use to_bytes::IterBytes;
|
||||
use vec::Vector;
|
||||
use vec::{Vector, OwnedVector, ImmutableVector};
|
||||
use super::{contains_nul, BytesContainer, GenericPath, GenericPathUnsafe};
|
||||
|
||||
/// Iterator that yields successive components of a Path as &str
|
||||
|
|
@ -1051,11 +1053,9 @@ fn prefix_len(p: Option<PathPrefix>) -> uint {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use super::parse_prefix;
|
||||
use option::{Some,None};
|
||||
use iter::Iterator;
|
||||
use vec::Vector;
|
||||
|
||||
macro_rules! t(
|
||||
(s: $path:expr, $exp:expr) => (
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
//! The exponential distribution.
|
||||
|
||||
use num::Exponential;
|
||||
use rand::{Rng, Rand};
|
||||
use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
|
||||
|
||||
|
|
@ -90,10 +91,10 @@ impl IndependentSample<f64> for Exp {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use rand::distributions::*;
|
||||
use prelude::*;
|
||||
use rand::*;
|
||||
use super::*;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
|
||||
#[test]
|
||||
fn test_exp() {
|
||||
|
|
@ -119,11 +120,11 @@ mod test {
|
|||
#[cfg(test)]
|
||||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use mem::size_of;
|
||||
use prelude::*;
|
||||
use rand::{XorShiftRng, RAND_BENCH_N};
|
||||
use super::*;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
use mem::size_of;
|
||||
use rand::distributions::*;
|
||||
|
||||
#[bench]
|
||||
fn rand_exp(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,11 @@
|
|||
|
||||
//! The Gamma and derived distributions.
|
||||
|
||||
use rand::{Rng, Open01};
|
||||
use super::{IndependentSample, Sample, Exp};
|
||||
use super::normal::StandardNormal;
|
||||
use num::Algebraic;
|
||||
use num;
|
||||
use rand::{Rng, Open01};
|
||||
use super::normal::StandardNormal;
|
||||
use super::{IndependentSample, Sample, Exp};
|
||||
|
||||
/// The Gamma distribution `Gamma(shape, scale)` distribution.
|
||||
///
|
||||
|
|
@ -309,10 +310,10 @@ impl IndependentSample<f64> for StudentT {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use rand::distributions::*;
|
||||
use prelude::*;
|
||||
use rand::*;
|
||||
use super::*;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
|
||||
#[test]
|
||||
fn test_chi_squared_one() {
|
||||
|
|
@ -370,13 +371,12 @@ mod test {
|
|||
|
||||
#[cfg(test)]
|
||||
mod bench {
|
||||
use super::*;
|
||||
use extra::test::BenchHarness;
|
||||
use mem::size_of;
|
||||
use prelude::*;
|
||||
use rand::distributions::IndependentSample;
|
||||
use rand::{StdRng, RAND_BENCH_N};
|
||||
use extra::test::BenchHarness;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
use super::*;
|
||||
|
||||
|
||||
#[bench]
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ that do not need to record state.
|
|||
|
||||
*/
|
||||
|
||||
use iter::range;
|
||||
use container::Container;
|
||||
use iter::{range, Iterator};
|
||||
use option::{Some, None};
|
||||
use num;
|
||||
use num::CheckedAdd;
|
||||
use rand::{Rng, Rand};
|
||||
use clone::Clone;
|
||||
use vec::MutableVector;
|
||||
|
||||
pub use self::range::Range;
|
||||
pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT};
|
||||
|
|
@ -250,9 +253,9 @@ fn ziggurat<R:Rng>(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use rand::*;
|
||||
use super::*;
|
||||
use option::{Some, None};
|
||||
|
||||
#[deriving(Eq)]
|
||||
struct ConstRand(uint);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
//! The normal and derived distributions.
|
||||
|
||||
use num::Exponential;
|
||||
use rand::{Rng, Rand, Open01};
|
||||
use rand::distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
|
||||
|
||||
|
|
@ -147,10 +148,10 @@ impl IndependentSample<f64> for LogNormal {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use rand::*;
|
||||
use super::*;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
use rand::distributions::*;
|
||||
|
||||
#[test]
|
||||
fn test_normal() {
|
||||
|
|
@ -187,11 +188,11 @@ mod tests {
|
|||
#[cfg(test)]
|
||||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use rand::{XorShiftRng, RAND_BENCH_N};
|
||||
use super::*;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
use mem::size_of;
|
||||
use prelude::*;
|
||||
use rand::{XorShiftRng, RAND_BENCH_N};
|
||||
use rand::distributions::*;
|
||||
use super::*;
|
||||
|
||||
#[bench]
|
||||
fn rand_normal(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -163,12 +163,11 @@ float_impl! { f64 }
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use rand::*;
|
||||
use rand::distributions::*;
|
||||
use num::Bounded;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
use vec::ImmutableVector;
|
||||
|
||||
#[should_fail]
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
use rand::{Rng, SeedableRng, OSRng};
|
||||
use iter::{Iterator, range, range_step, Repeat};
|
||||
use num::Times;
|
||||
use option::{None, Some};
|
||||
use vec::raw;
|
||||
use vec::{raw, MutableVector, ImmutableVector};
|
||||
use mem;
|
||||
|
||||
static RAND_SIZE_LEN: u32 = 8;
|
||||
|
|
@ -432,8 +433,7 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
|
|||
mod test {
|
||||
use super::*;
|
||||
use rand::{Rng, SeedableRng, OSRng};
|
||||
use option::Some;
|
||||
use iter::range;
|
||||
use prelude::*;
|
||||
use vec;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -656,8 +656,7 @@ pub struct Closed01<F>(F);
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use iter::{Iterator, range};
|
||||
use option::{Option, Some};
|
||||
use prelude::*;
|
||||
use vec;
|
||||
use super::*;
|
||||
|
||||
|
|
@ -845,11 +844,10 @@ static RAND_BENCH_N: u64 = 100;
|
|||
|
||||
#[cfg(test)]
|
||||
mod bench {
|
||||
use prelude::*;
|
||||
use extra::test::BenchHarness;
|
||||
use rand::{XorShiftRng, StdRng, IsaacRng, Isaac64Rng, Rng, RAND_BENCH_N};
|
||||
use mem::size_of;
|
||||
use iter::range;
|
||||
use option::{Some, None};
|
||||
|
||||
#[bench]
|
||||
fn rand_xorshift(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ impl Rng for OSRng {
|
|||
unsafe { cast::transmute(v) }
|
||||
}
|
||||
fn fill_bytes(&mut self, v: &mut [u8]) {
|
||||
use container::Container;
|
||||
use vec::MutableVector;
|
||||
|
||||
extern {
|
||||
fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD,
|
||||
pbBuffer: *mut BYTE);
|
||||
|
|
|
|||
|
|
@ -226,9 +226,8 @@ impl<T: Rand + 'static> Rand for @T {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use rand::{Rng, task_rng, Open01, Closed01};
|
||||
use iter::range;
|
||||
use option::{None, Some};
|
||||
|
||||
struct ConstantRng(u64);
|
||||
impl Rng for ConstantRng {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
//! A wrapper around any Reader to treat it as an RNG.
|
||||
|
||||
use container::Container;
|
||||
use option::{Some, None};
|
||||
use io::Reader;
|
||||
|
||||
|
|
@ -77,6 +78,8 @@ mod test {
|
|||
use super::*;
|
||||
use io::mem::MemReader;
|
||||
use cast;
|
||||
use rand::*;
|
||||
use prelude::*;
|
||||
|
||||
#[test]
|
||||
fn test_reader_rng_u64() {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@
|
|||
//! A wrapper around another RNG that reseeds it after it
|
||||
//! generates a certain number of random bytes.
|
||||
|
||||
use rand::{Rng, SeedableRng};
|
||||
use container::Container;
|
||||
use default::Default;
|
||||
use rand::{Rng, SeedableRng};
|
||||
|
||||
/// How many bytes of entropy the underling RNG is allowed to generate
|
||||
/// before it is reseeded.
|
||||
|
|
@ -141,11 +142,9 @@ impl Default for ReseedWithDefault {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use rand::{SeedableRng, Rng};
|
||||
use default::Default;
|
||||
use iter::range;
|
||||
use option::{None, Some};
|
||||
|
||||
struct Counter {
|
||||
i: u32
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ impl<T> Drop for Rc<T> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test_rc {
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use cell::RefCell;
|
||||
|
||||
|
|
|
|||
|
|
@ -293,10 +293,9 @@ pub fn fold_<T,E,Iter:Iterator<Result<T,E>>>(iterator: Iter) -> Result<(),E> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use prelude::*;
|
||||
|
||||
use iter::range;
|
||||
use to_str::ToStr;
|
||||
use vec::ImmutableVector;
|
||||
|
||||
pub fn op1() -> Result<int, ~str> { Ok(666) }
|
||||
pub fn op2() -> Result<int, ~str> { Err(~"sadface") }
|
||||
|
|
|
|||
|
|
@ -64,8 +64,10 @@ pub unsafe fn init(argc: int, argv: **u8) { realargs::init(argc, argv) }
|
|||
#[cfg(target_os = "freebsd")]
|
||||
mod imp {
|
||||
use cast;
|
||||
use clone::Clone;
|
||||
#[cfg(not(test))] use libc;
|
||||
use option::{Option, Some, None};
|
||||
use ptr::RawPtr;
|
||||
use iter::Iterator;
|
||||
#[cfg(not(test))] use str;
|
||||
use unstable::finally::Finally;
|
||||
|
|
@ -138,7 +140,7 @@ mod imp {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use option::{Some, None};
|
||||
use prelude::*;
|
||||
use super::*;
|
||||
use unstable::finally::Finally;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
use c_str::{ToCStr, CString};
|
||||
use container::Container;
|
||||
use iter::Iterator;
|
||||
use libc::{c_char, size_t};
|
||||
use option::{Option, None, Some};
|
||||
use ptr::RawPtr;
|
||||
|
|
@ -19,7 +21,7 @@ use str::OwnedStr;
|
|||
use str;
|
||||
use uint;
|
||||
use unstable::raw;
|
||||
use vec::ImmutableVector;
|
||||
use vec::{ImmutableVector, OwnedVector};
|
||||
|
||||
pub static FROZEN_BIT: uint = 1 << (uint::bits - 1);
|
||||
pub static MUT_BIT: uint = 1 << (uint::bits - 2);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@
|
|||
|
||||
use container::MutableSet;
|
||||
use hashmap::HashSet;
|
||||
use iter::Iterator;
|
||||
use option::{Some, None, Option};
|
||||
use ptr::RawPtr;
|
||||
use vec::ImmutableVector;
|
||||
use rt::rtio::EventLoop;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
use libc::{c_void, c_char, size_t, uintptr_t, free, malloc, realloc};
|
||||
use ptr::RawPtr;
|
||||
use unstable::intrinsics::TyDesc;
|
||||
use unstable::raw;
|
||||
use mem::size_of;
|
||||
|
|
|
|||
|
|
@ -11,18 +11,21 @@
|
|||
//! The local, garbage collected heap
|
||||
|
||||
use cast;
|
||||
use iter::Iterator;
|
||||
use libc::{c_void, uintptr_t};
|
||||
use libc;
|
||||
use mem;
|
||||
use ops::Drop;
|
||||
use option::{Option, None, Some};
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
use rt::env;
|
||||
use rt::global_heap;
|
||||
use rt::local::Local;
|
||||
use rt::task::Task;
|
||||
use unstable::intrinsics::TyDesc;
|
||||
use unstable::raw;
|
||||
use vec::ImmutableVector;
|
||||
|
||||
// This has no meaning with out rtdebug also turned on.
|
||||
#[cfg(rtdebug)]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
use cast;
|
||||
use ops::Drop;
|
||||
use ptr::RawPtr;
|
||||
|
||||
#[cfg(windows)] // mingw-w32 doesn't like thread_local things
|
||||
#[cfg(target_os = "android")] // see #10686
|
||||
|
|
@ -79,6 +80,7 @@ pub unsafe fn borrow<T>() -> Borrowed<T> {
|
|||
pub mod compiled {
|
||||
use cast;
|
||||
use option::{Option, Some, None};
|
||||
use ptr::RawPtr;
|
||||
#[cfg(not(test))] use libc::c_void;
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
@ -177,6 +179,7 @@ pub mod native {
|
|||
use libc::c_void;
|
||||
use option::{Option, Some, None};
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
use tls = rt::thread_local_storage;
|
||||
|
||||
static mut RT_TLS_KEY: tls::Key = -1;
|
||||
|
|
|
|||
|
|
@ -8,12 +8,14 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use container::Container;
|
||||
use from_str::from_str;
|
||||
use iter::Iterator;
|
||||
use libc::exit;
|
||||
use option::{Some, None, Option};
|
||||
use rt::crate_map::{ModEntry, CrateMap, iter_crate_map, get_crate_map};
|
||||
use str::StrSlice;
|
||||
use vec::{ImmutableVector, MutableTotalOrdVector};
|
||||
use vec::{ImmutableVector, MutableTotalOrdVector, OwnedVector};
|
||||
#[cfg(test)] use cast::transmute;
|
||||
|
||||
struct LogDirective {
|
||||
|
|
|
|||
|
|
@ -58,14 +58,9 @@ Several modules in `core` are clients of `rt`:
|
|||
#[allow(missing_doc)];
|
||||
|
||||
use any::Any;
|
||||
use clone::Clone;
|
||||
use container::Container;
|
||||
use iter::Iterator;
|
||||
use option::Option;
|
||||
use ptr::RawPtr;
|
||||
use result::Result;
|
||||
use task::TaskOpts;
|
||||
use vec::{OwnedVector, MutableVector, ImmutableVector};
|
||||
|
||||
use self::task::{Task, BlockedTask};
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use any::AnyOwnExt;
|
|||
use borrow;
|
||||
use cast;
|
||||
use cleanup;
|
||||
use clone::Clone;
|
||||
use io::Writer;
|
||||
use iter::{Iterator, Take};
|
||||
use local_data;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ use kinds::Send;
|
|||
use libc::{c_void, c_char, size_t};
|
||||
use option::{Some, None, Option};
|
||||
use prelude::drop;
|
||||
use ptr::RawPtr;
|
||||
use result::{Err, Ok};
|
||||
use rt::local::Local;
|
||||
use rt::task::Task;
|
||||
|
|
@ -76,6 +77,7 @@ mod libunwind {
|
|||
//! Unwind library interface
|
||||
|
||||
#[allow(non_camel_case_types)];
|
||||
#[allow(dead_code)] // these are just bindings
|
||||
|
||||
use libc::{uintptr_t, uint64_t};
|
||||
|
||||
|
|
@ -261,7 +263,8 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
|
|||
// This is achieved by overriding the return value in search phase to always
|
||||
// say "catch!".
|
||||
|
||||
#[cfg(not(target_arch = "arm"))]
|
||||
#[cfg(not(target_arch = "arm"), not(test))]
|
||||
#[doc(hidden)]
|
||||
pub mod eabi {
|
||||
use uw = super::libunwind;
|
||||
use libc::c_int;
|
||||
|
|
@ -277,8 +280,6 @@ pub mod eabi {
|
|||
|
||||
#[lang="eh_personality"]
|
||||
#[no_mangle] // so we can reference it by name from middle/trans/base.rs
|
||||
#[doc(hidden)]
|
||||
#[cfg(not(test))]
|
||||
pub extern "C" fn rust_eh_personality(
|
||||
version: c_int,
|
||||
actions: uw::_Unwind_Action,
|
||||
|
|
@ -294,8 +295,6 @@ pub mod eabi {
|
|||
}
|
||||
|
||||
#[no_mangle] // referenced from rust_try.ll
|
||||
#[doc(hidden)]
|
||||
#[cfg(not(test))]
|
||||
pub extern "C" fn rust_eh_personality_catch(
|
||||
version: c_int,
|
||||
actions: uw::_Unwind_Action,
|
||||
|
|
@ -318,7 +317,7 @@ pub mod eabi {
|
|||
|
||||
// ARM EHABI uses a slightly different personality routine signature,
|
||||
// but otherwise works the same.
|
||||
#[cfg(target_arch = "arm")]
|
||||
#[cfg(target_arch = "arm", not(test))]
|
||||
pub mod eabi {
|
||||
use uw = super::libunwind;
|
||||
use libc::c_int;
|
||||
|
|
@ -332,8 +331,6 @@ pub mod eabi {
|
|||
|
||||
#[lang="eh_personality"]
|
||||
#[no_mangle] // so we can reference it by name from middle/trans/base.rs
|
||||
#[doc(hidden)]
|
||||
#[cfg(not(test))]
|
||||
pub extern "C" fn rust_eh_personality(
|
||||
state: uw::_Unwind_State,
|
||||
ue_header: *uw::_Unwind_Exception,
|
||||
|
|
@ -346,8 +343,6 @@ pub mod eabi {
|
|||
}
|
||||
|
||||
#[no_mangle] // referenced from rust_try.ll
|
||||
#[doc(hidden)]
|
||||
#[cfg(not(test))]
|
||||
pub extern "C" fn rust_eh_personality_catch(
|
||||
state: uw::_Unwind_State,
|
||||
ue_header: *uw::_Unwind_Exception,
|
||||
|
|
|
|||
|
|
@ -11,11 +11,13 @@
|
|||
use container::Container;
|
||||
use fmt;
|
||||
use from_str::FromStr;
|
||||
use iter::Iterator;
|
||||
use libc;
|
||||
use option::{Some, None, Option};
|
||||
use os;
|
||||
use str::StrSlice;
|
||||
use unstable::running_on_valgrind;
|
||||
use vec::ImmutableVector;
|
||||
|
||||
// Indicates whether we should perform expensive sanity checks, including rtassert!
|
||||
// XXX: Once the runtime matures remove the `true` below to turn off rtassert, etc.
|
||||
|
|
|
|||
|
|
@ -330,16 +330,15 @@ pub fn process_output(prog: &str, args: &[~str]) -> Option<ProcessOutput> {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use libc::c_int;
|
||||
use option::{Option, None, Some};
|
||||
use os;
|
||||
use path::Path;
|
||||
use run;
|
||||
use str;
|
||||
use task::spawn;
|
||||
use unstable::running_on_valgrind;
|
||||
use io::pipe::PipeStream;
|
||||
use io::{Writer, Reader, io_error, FileNotFound};
|
||||
use io::{io_error, FileNotFound};
|
||||
|
||||
#[test]
|
||||
#[cfg(not(target_os="android"))] // FIXME(#10380)
|
||||
|
|
|
|||
|
|
@ -176,14 +176,8 @@ impl IterBytes for SendStr {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use clone::{Clone, DeepClone};
|
||||
use cmp::{TotalEq, Ord, TotalOrd, Equiv};
|
||||
use cmp::Equal;
|
||||
use container::Container;
|
||||
use default::Default;
|
||||
use prelude::*;
|
||||
use send_str::{SendStrOwned, SendStrStatic};
|
||||
use str::Str;
|
||||
use to_str::ToStr;
|
||||
|
||||
#[test]
|
||||
fn test_send_str_traits() {
|
||||
|
|
|
|||
|
|
@ -977,11 +977,13 @@ static TAG_CONT_U8: u8 = 128u8;
|
|||
/// Unsafe operations
|
||||
pub mod raw {
|
||||
use cast;
|
||||
use container::Container;
|
||||
use libc;
|
||||
use ptr;
|
||||
use str::{is_utf8, OwnedStr};
|
||||
use ptr::RawPtr;
|
||||
use str::{is_utf8, OwnedStr, StrSlice};
|
||||
use vec;
|
||||
use vec::MutableVector;
|
||||
use vec::{MutableVector, ImmutableVector, OwnedVector};
|
||||
use unstable::raw::Slice;
|
||||
|
||||
/// Create a Rust string from a *u8 buffer of the given length
|
||||
|
|
@ -1137,10 +1139,12 @@ Section: Trait implementations
|
|||
#[cfg(not(test))]
|
||||
#[allow(missing_doc)]
|
||||
pub mod traits {
|
||||
use ops::Add;
|
||||
use container::Container;
|
||||
use cmp::{TotalOrd, Ordering, Less, Equal, Greater, Eq, Ord, Equiv, TotalEq};
|
||||
use super::{Str, eq_slice};
|
||||
use iter::Iterator;
|
||||
use ops::Add;
|
||||
use option::{Some, None};
|
||||
use str::{Str, StrSlice, OwnedStr, eq_slice};
|
||||
|
||||
impl<'a> Add<&'a str,~str> for &'a str {
|
||||
#[inline]
|
||||
|
|
@ -2764,14 +2768,11 @@ impl Default for @str {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use container::Container;
|
||||
use option::{None, Some, Option};
|
||||
use iter::AdditiveIterator;
|
||||
use prelude::*;
|
||||
use ptr;
|
||||
use str::*;
|
||||
use vec::{Vector, ImmutableVector, CopyableVector};
|
||||
use cmp::{TotalOrd, Less, Equal, Greater};
|
||||
use send_str::{SendStrOwned, SendStrStatic};
|
||||
use from_str::from_str;
|
||||
|
||||
#[test]
|
||||
fn test_eq() {
|
||||
|
|
|
|||
|
|
@ -199,11 +199,12 @@ pub mod dl {
|
|||
|
||||
#[cfg(target_os = "win32")]
|
||||
pub mod dl {
|
||||
use os;
|
||||
use libc;
|
||||
use os;
|
||||
use path::GenericPath;
|
||||
use path;
|
||||
use ptr;
|
||||
use result::*;
|
||||
use result::{Ok, Err, Result};
|
||||
|
||||
pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void {
|
||||
os::win32::as_utf16_p(filename.as_str().unwrap(), |raw_name| {
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ mod imp {
|
|||
use libc::c_void;
|
||||
use libc;
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
|
||||
type pthread_mutex_t = libc::c_void;
|
||||
type pthread_mutexattr_t = libc::c_void;
|
||||
|
|
@ -248,6 +249,8 @@ mod imp {
|
|||
use libc;
|
||||
use libc::{HANDLE, BOOL, LPSECURITY_ATTRIBUTES, c_void, DWORD, LPCSTR};
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
|
||||
type LPCRITICAL_SECTION = *c_void;
|
||||
static SPIN_COUNT: DWORD = 4000;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@ static RED_ZONE: uint = 20 * 1024;
|
|||
// irrelevant for documentation purposes.
|
||||
#[cfg(not(test))] // in testing, use the original libstd's version
|
||||
pub extern "C" fn rust_stack_exhausted() {
|
||||
use rt::task::Task;
|
||||
use option::None;
|
||||
use rt::local::Local;
|
||||
use rt::task::Task;
|
||||
use str::Str;
|
||||
use unstable::intrinsics;
|
||||
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -78,10 +78,7 @@ impl Void {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use clone::Clone;
|
||||
use ops::Drop;
|
||||
use option::{None, Some};
|
||||
use prelude::*;
|
||||
use mem::size_of;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -611,6 +611,7 @@ impl<'a, T> RandomAccessIterator<&'a [T]> for ChunkIter<'a, T> {
|
|||
pub mod traits {
|
||||
use super::*;
|
||||
|
||||
use container::Container;
|
||||
use clone::Clone;
|
||||
use cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Equiv};
|
||||
use iter::order;
|
||||
|
|
@ -2520,7 +2521,7 @@ pub unsafe fn from_buf<T>(ptr: *T, elts: uint) -> ~[T] {
|
|||
pub mod raw {
|
||||
use cast;
|
||||
use ptr;
|
||||
use vec::{with_capacity, MutableVector};
|
||||
use vec::{with_capacity, MutableVector, OwnedVector};
|
||||
use unstable::raw::Slice;
|
||||
|
||||
/**
|
||||
|
|
@ -2599,8 +2600,9 @@ pub mod raw {
|
|||
/// Operations on `[u8]`.
|
||||
pub mod bytes {
|
||||
use container::Container;
|
||||
use vec::MutableVector;
|
||||
use vec::{MutableVector, OwnedVector, ImmutableVector};
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
|
||||
/// A trait for operations on mutable `[u8]`s.
|
||||
pub trait MutableByteVector {
|
||||
|
|
@ -2968,10 +2970,10 @@ impl<A> Extendable<A> for ~[A] {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use prelude::*;
|
||||
use mem;
|
||||
use vec::*;
|
||||
use cmp::*;
|
||||
use prelude::*;
|
||||
use rand::{Rng, task_rng};
|
||||
|
||||
fn square(n: uint) -> uint { n * n }
|
||||
|
|
@ -4452,13 +4454,11 @@ mod tests {
|
|||
#[cfg(test)]
|
||||
mod bench {
|
||||
use extra::test::BenchHarness;
|
||||
use iter::range;
|
||||
use vec;
|
||||
use vec::{VectorVector, MutableTotalOrdVector};
|
||||
use option::*;
|
||||
use mem;
|
||||
use prelude::*;
|
||||
use ptr;
|
||||
use rand::{weak_rng, Rng};
|
||||
use mem;
|
||||
use vec;
|
||||
|
||||
#[bench]
|
||||
fn iterator(bh: &mut BenchHarness) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ library.
|
|||
use ast::{enum_def, Ident, item, Generics, struct_def};
|
||||
use ast::{MetaItem, MetaList, MetaNameValue, MetaWord};
|
||||
use ext::base::ExtCtxt;
|
||||
use ext::build::AstBuilder;
|
||||
use codemap::Span;
|
||||
|
||||
pub mod clone;
|
||||
|
|
|
|||
|
|
@ -1109,6 +1109,7 @@ mod test {
|
|||
use codemap;
|
||||
use codemap::Spanned;
|
||||
use fold;
|
||||
use fold::*;
|
||||
use parse;
|
||||
use parse::token::{fresh_mark, gensym, intern, ident_to_str};
|
||||
use parse::token;
|
||||
|
|
|
|||
33
src/test/compile-fail/issue-10465.rs
Normal file
33
src/test/compile-fail/issue-10465.rs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub mod a {
|
||||
pub trait A {
|
||||
fn foo(&self);
|
||||
}
|
||||
|
||||
}
|
||||
pub mod b {
|
||||
use a::A;
|
||||
|
||||
pub struct B;
|
||||
impl A for B { fn foo(&self) {} }
|
||||
|
||||
pub mod c {
|
||||
use b::B;
|
||||
|
||||
fn foo(b: &B) {
|
||||
b.foo(); //~ ERROR: does not implement any method in scope named
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue