#![allow(missing_docs)]
#![stable(feature = "rust1", since = "1.0.0")]
-use core::ops::{Drop, Deref, DerefMut};
+use core::ops::{Deref, DerefMut};
use core::iter::{FromIterator, FusedIterator};
use core::mem::swap;
use core::mem::size_of;
#![stable(feature = "rust1", since = "1.0.0")]
-use core::clone::Clone;
-use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
-use core::convert::AsRef;
-use core::default::Default;
+use core::cmp::Ordering;
use core::hash::{Hash, Hasher};
-use core::marker::Sized;
use core::ops::Deref;
-use core::option::Option;
use fmt;
#[cfg(test)]
mod tests {
- use std::clone::Clone;
- use std::iter::{Iterator, IntoIterator, Extend};
- use std::option::Option::{self, Some, None};
use std::__rand::{thread_rng, Rng};
use std::thread;
use std::vec::Vec;
#[test]
fn test_26021() {
- use std::iter::ExactSizeIterator;
// There was a bug in split_off that failed to null out the RHS's head's prev ptr.
// This caused the RHS's dtor to walk up into the LHS at drop and delete all of
// its nodes.
//! Range syntax.
-use core::option::Option::{self, None, Some};
use core::ops::{RangeFull, Range, RangeTo, RangeFrom};
/// **RangeArgument** is implemented by Rust's built-in range types, produced
#[cfg(test)]
mod tests {
- use core::iter::Iterator;
- use core::option::Option::Some;
-
use test;
use super::VecDeque;
#![stable(feature = "rust1", since = "1.0.0")]
use fmt;
-use marker::Send;
use mem::transmute;
-use option::Option::{self, Some, None};
use raw::TraitObject;
use intrinsics;
-use marker::{Reflect, Sized};
+use marker::Reflect;
///////////////////////////////////////////////////////////////////////////////
// Any trait
issue = "27778")]
use borrow::{Borrow, BorrowMut};
-use clone::Clone;
-use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
-use convert::{AsRef, AsMut};
-use default::Default;
+use cmp::Ordering;
use fmt;
use hash::{Hash, self};
-use iter::IntoIterator;
-use marker::{Copy, Sized, Unsize};
-use option::Option;
-use slice::{Iter, IterMut, SliceExt};
+use marker::Unsize;
+use slice::{Iter, IterMut};
/// Utility trait implemented only on arrays of fixed size
///
#![stable(feature = "rust1", since = "1.0.0")]
-use marker::Sized;
-
/// A trait for borrowing data.
///
/// In general, there may be several ways to "borrow" a piece of data. The
#![stable(feature = "rust1", since = "1.0.0")]
-use clone::Clone;
-use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
-use convert::From;
-use default::Default;
+use cmp::Ordering;
use fmt::{self, Debug, Display};
-use marker::{Copy, PhantomData, Send, Sync, Sized, Unsize};
-use ops::{Deref, DerefMut, Drop, FnOnce, CoerceUnsized};
-use option::Option;
-use option::Option::{None, Some};
-use result::Result;
-use result::Result::{Ok, Err};
+use marker::{PhantomData, Unsize};
+use ops::{Deref, DerefMut, CoerceUnsized};
/// A mutable memory location that admits only `Copy` data.
///
#![allow(non_snake_case)]
#![stable(feature = "core_char", since = "1.2.0")]
-use prelude::v1::*;
-
use char_private::is_printable;
use iter::FusedIterator;
use mem::transmute;
// NOTE: The following code was generated by "src/etc/char_private.py",
// do not edit directly!
-use slice::SliceExt;
-
fn check(x: u16, singletons: &[u16], normal: &[u16]) -> bool {
for &s in singletons {
if x == s {
#![stable(feature = "rust1", since = "1.0.0")]
-use marker::Sized;
-
/// A common trait for the ability to explicitly duplicate an object.
///
/// Differs from `Copy` in that `Copy` is implicit and extremely inexpensive, while
use self::Ordering::*;
-use marker::Sized;
-use option::Option::{self, Some};
-
/// Trait for equality comparisons which are [partial equivalence
/// relations](http://en.wikipedia.org/wiki/Partial_equivalence_relation).
///
// Implementation of PartialEq, Eq, PartialOrd and Ord for primitive types
mod impls {
- use cmp::{PartialOrd, Ord, PartialEq, Eq, Ordering};
- use cmp::Ordering::{Less, Greater, Equal};
- use marker::Sized;
- use option::Option;
- use option::Option::{Some, None};
+ use cmp::Ordering::{self, Less, Greater, Equal};
macro_rules! partial_eq_impl {
($($t:ty)*) => ($(
#![stable(feature = "rust1", since = "1.0.0")]
-use marker::Sized;
-use result::Result;
-
/// A cheap, reference-to-reference conversion.
///
/// `AsRef` is very similar to, but different than, `Borrow`. See
#![stable(feature = "rust1", since = "1.0.0")]
-use marker::Sized;
-
/// A trait for giving a type a useful default value.
///
/// Sometimes, you want to fall back to some kind of default value, and
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use fmt::{self, FlagV1};
struct PadAdapter<'a, 'b: 'a> {
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState};
use marker::PhantomData;
use mem;
prefix: &str,
buf: &str)
-> Result {
- use char::CharExt;
-
let mut width = buf.len();
let mut sign = None;
f: F) -> Result
where F: FnOnce(&mut Formatter) -> Result,
{
- use char::CharExt;
let align = match self.align {
rt::v1::Alignment::Unknown => default,
_ => self.align
// FIXME: #6220 Implement floating point formatting
-use prelude::v1::*;
-
use fmt;
use num::Zero;
use ops::{Div, Rem, Sub};
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use fmt;
use marker;
use mem;
//////////////////////////////////////////////////////////////////////////////
mod impls {
- use prelude::v1::*;
-
use mem;
use slice;
use super::*;
//! An implementation of SipHash.
-use prelude::v1::*;
-
use marker::PhantomData;
use ptr;
issue = "0")]
#![allow(missing_docs)]
-use marker::Sized;
-
extern "rust-intrinsic" {
// NB: These intrinsics take raw pointers because they mutate aliased
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use clone::Clone;
-use cmp::{Ord, PartialOrd, PartialEq, Ordering};
-use default::Default;
-use ops::FnMut;
-use option::Option::{self, Some, None};
-use marker::Sized;
+use cmp::Ordering;
use super::{Chain, Cycle, Cloned, Enumerate, Filter, FilterMap, FlatMap, Fuse};
use super::{Inspect, Map, Peekable, Scan, Skip, SkipWhile, Take, TakeWhile, Rev};
use super::{Zip, Sum, Product};
-use super::ChainState;
-use super::{DoubleEndedIterator, ExactSizeIterator, Extend, FromIterator};
-use super::{IntoIterator, ZipImpl};
+use super::{ChainState, FromIterator, ZipImpl};
fn _assert_is_object_safe(_: &Iterator<Item=()>) {}
#![stable(feature = "rust1", since = "1.0.0")]
-use clone::Clone;
use cmp;
-use default::Default;
use fmt;
use iter_private::TrustedRandomAccess;
-use ops::FnMut;
-use option::Option::{self, Some, None};
use usize;
#[stable(feature = "rust1", since = "1.0.0")]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use clone::Clone;
-use cmp::PartialOrd;
use mem;
use ops::{self, Add, Sub};
-use option::Option::{self, Some, None};
-use marker::Sized;
use usize;
-use super::{DoubleEndedIterator, ExactSizeIterator, Iterator, FusedIterator};
+use super::FusedIterator;
/// Objects that can be stepped over in both directions.
///
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use clone::Clone;
-use default::Default;
use fmt;
use marker;
-use option::Option::{self, Some, None};
use usize;
-use super::{DoubleEndedIterator, IntoIterator, Iterator, ExactSizeIterator, FusedIterator};
+use super::FusedIterator;
/// An iterator that repeats an element endlessly.
///
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use option::Option::{self, Some};
-use marker::Sized;
-
-use super::Iterator;
-
/// Conversion from an `Iterator`.
///
/// By implementing `FromIterator` for a type, you define how it will be
// except according to those terms.
-use iter::ExactSizeIterator;
-
/// An iterator whose items are random accessible efficiently
///
/// # Safety
#![feature(unboxed_closures)]
#![feature(question_mark)]
#![feature(never_type)]
+#![feature(prelude_import)]
+
+#[prelude_import]
+#[allow(unused)]
+use prelude::v1::*;
#[macro_use]
mod macros;
#![stable(feature = "rust1", since = "1.0.0")]
-use clone::Clone;
use cmp;
-use default::Default;
-use option::Option;
use hash::Hash;
use hash::Hasher;
impls! { PhantomData }
mod impls {
- use super::{Send, Sync, Sized};
-
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
#[stable(feature = "rust1", since = "1.0.0")]
#![stable(feature = "rust1", since = "1.0.0")]
-use marker::Sized;
use intrinsics;
use ptr;
reason = "needs an RFC to flesh out the design",
issue = "27730")]
-use marker::Sized;
use ops::{CoerceUnsized, Deref};
/// Unsafe trait to indicate what types are usable with the NonZero struct
issue = "0")]
#![macro_use]
-use prelude::v1::*;
-
use mem;
use intrinsics;
// this one is used for testing only.
#[doc(hidden)]
pub mod tests {
- use prelude::v1::*;
define_bignum!(Big8x3: type=u8, n=3);
}
//! The various algorithms from the paper.
-use prelude::v1::*;
use cmp::min;
use cmp::Ordering::{Less, Equal, Greater};
use num::diy_float::Fp;
#[cfg(all(target_arch="x86", not(target_feature="sse2")))]
mod fpu_precision {
use mem::size_of;
- use ops::Drop;
/// A structure used to preserve the original value of the FPU control word, so that it can be
/// restored when the structure is dropped.
reason = "internal routines only exposed for testing",
issue = "0")]
-use prelude::v1::*;
use fmt;
use str::FromStr;
// FIXME This module's name is a bit unfortunate, since other modules also import `core::num`.
-use prelude::v1::*;
use cmp::Ordering::{self, Less, Equal, Greater};
pub use num::bignum::Big32x40 as Big;
//! modules rely on to not panic (or overflow) in turn.
//! To make matters worse, all that happens in a single pass over the input.
//! So, be careful when modifying anything, and double-check with the other modules.
-use prelude::v1::*;
use super::num;
use self::ParseResult::{Valid, ShortcutToInf, ShortcutToZero, Invalid};
//! Many functions in this module only handle normal numbers. The dec2flt routines conservatively
//! take the universally-correct slow path (Algorithm M) for very small and very large numbers.
//! That algorithm needs only next_float() which does handle subnormals and zeros.
-use prelude::v1::*;
use u32;
use cmp::Ordering::{Less, Equal, Greater};
use ops::{Mul, Div, Neg};
//! Decodes a floating-point value into individual parts and error ranges.
-use prelude::v1::*;
-
use {f32, f64};
use num::FpCategory;
use num::dec2flt::rawfp::RawFloat;
reason = "internal routines only exposed for testing",
issue = "0")]
-use prelude::v1::*;
use i16;
pub use self::decoder::{decode, DecodableFloat, FullDecoded, Decoded};
quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116.
*/
-use prelude::v1::*;
-
use cmp::Ordering;
use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};
accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243.
*/
-use prelude::v1::*;
-
use num::diy_float::Fp;
use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};
#![stable(feature = "rust1", since = "1.0.0")]
-use char::CharExt;
-use cmp::PartialOrd;
-use convert::{From, TryFrom};
+use convert::TryFrom;
use fmt;
use intrinsics;
-use marker::{Copy, Sized};
use mem::size_of;
-use option::Option::{self, Some, None};
-use result::Result::{self, Ok, Err};
-use str::{FromStr, StrExt};
-use slice::SliceExt;
+use str::FromStr;
/// Provides intentionally-wrapped arithmetic on `T`.
///
#![stable(feature = "rust1", since = "1.0.0")]
-use cmp::PartialOrd;
use fmt;
-use marker::{Sized, Unsize};
-use result::Result::{self, Ok, Err};
+use marker::Unsize;
/// The `Drop` trait is used to run some code when a value goes out of scope.
/// This is sometimes called a 'destructor'.
}
mod impls {
- use marker::Sized;
- use super::{Fn, FnMut, FnOnce};
-
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> Fn<A> for &'a F
where F : Fn<A>
#![stable(feature = "rust1", since = "1.0.0")]
-use self::Option::*;
-
-use clone::Clone;
-use convert::From;
-use default::Default;
-use iter::{Iterator, FromIterator, IntoIterator, ExactSizeIterator, DoubleEndedIterator};
-use iter::FusedIterator;
+use iter::{FromIterator, FusedIterator};
use mem;
-use ops::FnOnce;
-use result::Result::{Ok, Err};
-use result::Result;
// Note that this is not a lang item per se, but it has a hidden dependency on
// `Iterator`, which is one. The compiler assumes that the `next` method of
#![stable(feature = "rust1", since = "1.0.0")]
-use clone::Clone;
use intrinsics;
use ops::{CoerceUnsized, Deref};
use fmt;
use hash;
-use option::Option::{self, Some, None};
-use marker::{Copy, PhantomData, Send, Sized, Sync, Unsize};
+use marker::{PhantomData, Unsize};
use mem;
use nonzero::NonZero;
-use cmp::{PartialEq, Eq, Ord, PartialOrd};
use cmp::Ordering::{self, Less, Equal, Greater};
// FIXME #19649: intrinsic docs don't render, so these have no docs :(
#![stable(feature = "rust1", since = "1.0.0")]
-use self::Result::{Ok, Err};
-
-use clone::Clone;
use fmt;
-use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSizeIterator, IntoIterator};
-use iter::FusedIterator;
-use ops::FnOnce;
-use option::Option::{self, None, Some};
+use iter::{FromIterator, FusedIterator};
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
///
// * The `raw` and `bytes` submodules.
// * Boilerplate trait implementations.
-use clone::Clone;
-use cmp::{Ordering, PartialEq, PartialOrd, Eq, Ord};
-use cmp::Ordering::{Less, Equal, Greater};
+use cmp::Ordering::{self, Less, Equal, Greater};
use cmp;
-use convert::AsRef;
-use default::Default;
use fmt;
use intrinsics::assume;
use iter::*;
-use ops::{FnMut, self};
-use ops::RangeFull;
-use option::Option;
-use option::Option::{None, Some};
-use result::Result;
-use result::Result::{Ok, Err};
+use ops::{self, RangeFull};
use ptr;
use mem;
-use marker::{Copy, Send, Sync, self};
+use marker;
use iter_private::TrustedRandomAccess;
#[repr(C)]
use self::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
use char;
-use clone::Clone;
-use convert::AsRef;
-use default::Default;
use fmt;
-use iter::ExactSizeIterator;
-use iter::{Map, Cloned, Iterator, DoubleEndedIterator, FusedIterator};
-use marker::Sized;
+use iter::{Map, Cloned, FusedIterator};
use mem;
-use ops::{Fn, FnMut, FnOnce};
-use option::Option::{self, None, Some};
-use result::Result::{self, Ok, Err};
-use slice::{self, SliceExt};
+use slice;
pub mod pattern;
*/
mod traits {
- use cmp::{Ord, Ordering, PartialEq, PartialOrd, Eq};
- use option::Option;
- use option::Option::Some;
+ use cmp::Ordering;
use ops;
- use str::{StrExt, eq_slice};
+ use str::eq_slice;
#[stable(feature = "rust1", since = "1.0.0")]
impl Ord for str {
reason = "API not fully fleshed out and ready to be stabilized",
issue = "27721")]
-use prelude::v1::*;
-
use cmp;
use fmt;
use usize;
use self::Ordering::*;
-use marker::{Send, Sync};
-
use intrinsics;
use cell::UnsafeCell;
-
-use result::Result::{self, Ok, Err};
-
-use default::Default;
use fmt;
/// A boolean type which can be safely shared between threads.
// See src/libstd/primitive_docs.rs for documentation.
-use clone::Clone;
use cmp::*;
use cmp::Ordering::*;
-use default::Default;
-use option::Option;
-use option::Option::Some;
// FIXME(#19630) Remove this work-around
macro_rules! e {
declare_lint! {
pub TRANSMUTE_FROM_FN_ITEM_TYPES,
- Warn,
+ Deny,
"transmute from function item type to pointer-sized type erroneously allowed"
}
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use mem;
use ops::Range;
use iter::FusedIterator;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use super::*;
use char::from_u32;
#[cfg(test)]
mod test_map {
- use prelude::v1::*;
-
use super::HashMap;
use super::Entry::{Occupied, Vacant};
use cell::RefCell;
#[cfg(test)]
mod test_set {
- use prelude::v1::*;
-
use super::HashSet;
#[test]
#![stable(feature = "env", since = "1.0.0")]
-use prelude::v1::*;
-
use error::Error;
use ffi::{OsStr, OsString};
use fmt;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use super::*;
use iter::repeat;
// reconsider what crate these items belong in.
use any::TypeId;
-use boxed::Box;
use cell;
use char;
use fmt::{self, Debug, Display};
-use marker::{Send, Sync, Reflect};
+use marker::Reflect;
use mem::transmute;
use num;
use raw::TraitObject;
use str;
-use string::{self, String};
+use string;
/// Base functionality for all errors in Rust.
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use super::Error;
use fmt;
// except according to those terms.
use ascii;
-use borrow::{Cow, ToOwned, Borrow};
-use boxed::Box;
-use convert::{Into, From};
-use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
+use borrow::{Cow, Borrow};
+use cmp::Ordering;
use error::Error;
use fmt::{self, Write};
use io;
-use iter::Iterator;
use libc;
use mem;
use memchr;
use ops;
-use option::Option::{self, Some, None};
use os::raw::c_char;
-use result::Result::{self, Ok, Err};
use slice;
use str::{self, Utf8Error};
-use string::String;
-use vec::Vec;
/// A type representing an owned C-compatible string
///
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use super::*;
use os::raw::c_char;
use borrow::Cow::{Borrowed, Owned};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use borrow::{Borrow, Cow, ToOwned};
+use borrow::{Borrow, Cow};
use fmt::{self, Debug};
use mem;
-use string::String;
use ops;
use cmp;
use hash::{Hash, Hasher};
-use vec::Vec;
use sys::os_str::{Buf, Slice};
use sys_common::{AsInner, IntoInner, FromInner};
use path::{Path, PathBuf};
use sys::fs as fs_imp;
use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner};
-use vec::Vec;
use time::SystemTime;
/// A reference to an open file on the filesystem.
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use fs::{self, File, OpenOptions};
//! Buffering wrappers for I/O traits
-use prelude::v1::*;
use io::prelude::*;
use marker::Reflect;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use io::{self, BufReader, BufWriter, LineWriter, SeekFrom};
use sync::atomic::{AtomicUsize, Ordering};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use io::prelude::*;
use cmp;
mod tests {
use io::prelude::*;
use io::{Cursor, SeekFrom};
- use vec::Vec;
#[test]
fn test_vec_writer() {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use boxed::Box;
-use convert::Into;
use error;
use fmt;
-use marker::{Send, Sync};
-use option::Option::{self, Some, None};
use result;
use sys;
#[cfg(test)]
mod test {
- use prelude::v1::*;
use super::{Error, ErrorKind};
use error;
use fmt;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use boxed::Box;
use cmp;
use io::{self, SeekFrom, Read, Write, Seek, BufRead, Error, ErrorKind};
use fmt;
use mem;
-use string::String;
-use vec::Vec;
// =============================================================================
// Forwarding implementations
#[cfg(test)]
mod tests {
use io::prelude::*;
- use vec::Vec;
use test;
#[bench]
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use cell::Cell;
use ptr;
use sync::Arc;
use rustc_unicode::str as core_str;
use error as std_error;
use fmt;
-use iter::{Iterator};
-use marker::Sized;
-use ops::{Drop, FnOnce};
-use option::Option::{self, Some, None};
-use result::Result::{Ok, Err};
use result;
-use string::String;
use str;
-use vec::Vec;
use memchr;
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use io;
use super::Cursor;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use io::prelude::*;
use cell::{RefCell, BorrowState};
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use io::prelude::*;
use io::{copy, sink, empty, repeat};
#![feature(optin_builtin_traits)]
#![feature(panic_unwind)]
#![feature(placement_in_syntax)]
+#![feature(prelude_import)]
#![feature(question_mark)]
#![feature(rand)]
#![feature(raw)]
#![allow(unused_features)] // std may use features in a platform-specific way
#![cfg_attr(not(stage0), deny(warnings))]
+#[prelude_import]
+#[allow(unused)]
+use prelude::v1::*;
+
#[cfg(test)] extern crate test;
// We want to reexport a few macros from core but libcore has already been
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use fmt;
use hash;
use io;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use net::*;
use net::test::{tsa, sa6, sa4};
// Tests for this module
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use net::*;
use net::Ipv6MulticastScope::*;
use net::test::{tsa, sa6, sa4};
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use io::{self, Error, ErrorKind};
use sys_common::net as net_imp;
//! This module is "publicly exported" through the `FromStr` implementations
//! below.
-use prelude::v1::*;
-
use error::Error;
use fmt;
use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use io::prelude::*;
use fmt;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use io::ErrorKind;
use io::prelude::*;
use net::*;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use env;
use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs};
use sync::atomic::{AtomicUsize, Ordering};
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use io::ErrorKind;
use net::*;
use net::test::{next_test_ip4, next_test_ip6};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::num::Wrapping;
-#[cfg(test)] use cmp::PartialEq;
#[cfg(test)] use fmt;
-#[cfg(test)] use marker::Copy;
#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
/// Helper function for testing numeric operations
use u32;
use u64;
use usize;
- use string::ToString;
use ops::Mul;
#[test]
mod bench {
extern crate test;
use self::test::Bencher;
- use prelude::v1::*;
#[bench]
fn bench_pow_function(b: &mut Bencher) {
#![stable(feature = "std_panic", since = "1.9.0")]
use any::Any;
-use boxed::Box;
use cell::UnsafeCell;
use ops::{Deref, DerefMut};
use panicking;
//! * Executing a panic up to doing the actual implementation
//! * Shims around "try"
-use prelude::v1::*;
use io::prelude::*;
use any::Any;
#![stable(feature = "rust1", since = "1.0.0")]
use ascii::*;
-use borrow::{Borrow, ToOwned, Cow};
+use borrow::{Borrow, Cow};
use cmp;
use error::Error;
use fmt;
use iter::{self, FusedIterator};
use mem;
use ops::{self, Deref};
-use string::String;
-use vec::Vec;
use ffi::{OsStr, OsString};
#[cfg(test)]
mod tests {
use super::*;
- use string::{ToString, String};
- use vec::Vec;
macro_rules! t(
($path:expr, iter: $iter:expr) => (
#![stable(feature = "process", since = "1.0.0")]
-use prelude::v1::*;
use io::prelude::*;
use ffi::OsStr;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use io::ErrorKind;
#[cfg(not(test))]
#[lang = "start"]
fn lang_start(main: *const u8, argc: isize, argv: *const *const u8) -> isize {
- use borrow::ToOwned;
use mem;
use panic;
use sys;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::{Arc, Barrier};
use sync::mpsc::{channel, TryRecvError};
use thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use sync::atomic::{AtomicUsize, Ordering};
use sync::{mutex, MutexGuard, PoisonError};
use sys_common::condvar as sys;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::mpsc::channel;
use sync::{Condvar, Mutex, Arc};
use thread;
use thread::{self, Thread};
use sync::atomic::{AtomicBool, Ordering};
use sync::Arc;
-use marker::{Sync, Send};
use mem;
-use clone::Clone;
use time::Instant;
struct Inner {
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use env;
use super::*;
use thread;
#[cfg(test)]
mod sync_tests {
- use prelude::v1::*;
-
use env;
use thread;
use super::*;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::mpsc::channel;
use super::{Queue, Data, Empty, Inconsistent};
use sync::Arc;
#[cfg(test)]
#[allow(unused_imports)]
mod tests {
- use prelude::v1::*;
-
use thread;
use sync::mpsc::*;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::Arc;
use super::Queue;
use thread;
pub use self::Failure::*;
use self::Blocker::*;
-use vec::Vec;
use core::mem;
use core::ptr;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use cell::UnsafeCell;
use fmt;
use marker;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::mpsc::channel;
use sync::{Arc, Mutex, Condvar};
use sync::atomic::{AtomicUsize, Ordering};
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use panic;
use sync::mpsc::channel;
use thread;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use cell::UnsafeCell;
use fmt;
use marker;
mod tests {
#![allow(deprecated)] // rand
- use prelude::v1::*;
-
use rand::{self, Rng};
use sync::mpsc::channel;
use thread;
#[test]
fn test_rwlock_try_write() {
- use mem::drop;
-
let lock = RwLock::new(0isize);
let read_guard = lock.read().unwrap();
#![allow(dead_code)] // different code on OSX/linux/etc
-use vec::Vec;
-
/// One-time global initialization.
pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) }
target_os = "solaris",
target_os = "emscripten"))]
mod imp {
- use prelude::v1::*;
-
use libc::c_char;
use mem;
use ffi::CStr;
target_os = "ios",
target_os = "windows"))]
mod imp {
- use vec::Vec;
-
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
}
//! Documentation can be found on the `rt::at_exit` function.
use alloc::boxed::FnBox;
-use boxed::Box;
use ptr;
use sys_common::mutex::Mutex;
-use vec::Vec;
type Queue = Vec<Box<FnBox()>>;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use sys_common;
macro_rules! t { ($a:expr, $b:expr) => ({
let mut m = Vec::new();
// <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.
-use prelude::v1::*;
use io;
use io::ErrorKind;
use io::Read;
#[cfg(test)]
pub mod test {
- use prelude::v1::*;
use path::{Path, PathBuf};
use env;
use rand::{self, Rng};
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use io::prelude::*;
use super::*;
use io;
#![allow(missing_docs)]
-use boxed::Box;
use sync::Once;
use sys;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use marker::Sync;
use sys::mutex as imp;
/// An OS-based mutual exclusion lock.
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use cmp;
use ffi::CString;
use fmt;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use super::*;
use collections::HashMap;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use fmt;
use marker;
use ops::Deref;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard};
use cell::RefCell;
use sync::Arc;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use alloc::boxed::FnBox;
use libc;
use sys::stack_overflow;
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
use cell::RefCell;
-use string::String;
use thread::Thread;
use thread::LocalKeyState;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use super::{Key, StaticKey};
fn assert_sync<T: Sync>() {}
use ops;
use slice;
use str;
-use string::String;
use sys_common::AsInner;
-use vec::Vec;
const UTF8_REPLACEMENT_CHARACTER: &'static [u8] = b"\xEF\xBF\xBD";
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use borrow::Cow;
use super::*;
use ffi::{OsStr, OsString};
use mem;
-use prelude::v1::*;
use sys::os_str::Buf;
use sys_common::{FromInner, IntoInner, AsInner};
use libc;
-use prelude::v1::*;
use ascii;
use ffi::OsStr;
use fmt;
#[cfg(test)]
mod test {
- use prelude::v1::*;
use thread;
use io;
use io::prelude::*;
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use io;
use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd};
use process;
#![unstable(reason = "not public", issue = "0", feature = "fd")]
-use prelude::v1::*;
-
use io::{self, Read};
use libc::{self, c_int, size_t, c_void};
use mem;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::unix::prelude::*;
use ffi::{CString, CStr, OsString, OsStr};
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
#[cfg(target_os = "linux")]
fn get_path(fd: c_int) -> Option<PathBuf> {
- use string::ToString;
let mut p = PathBuf::from("/proc/self/fd");
p.push(&fd.to_string());
readlink(&p).ok()
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use ffi::CStr;
use io;
use libc::{self, c_int, size_t, sockaddr, socklen_t};
#![allow(unused_imports)] // lots of cfg code here
-use prelude::v1::*;
use os::unix::prelude::*;
use error::Error as StdError;
use borrow::Cow;
use fmt::{self, Debug};
-use vec::Vec;
use str;
-use string::String;
use mem;
use sys_common::{AsInner, IntoInner};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use cmp;
use io;
use libc::{self, c_int};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::unix::prelude::*;
use collections::hash_map::{HashMap, Entry};
#[cfg(test)]
mod tests {
use super::*;
- use prelude::v1::*;
use ffi::OsStr;
use mem;
pub use self::imp::OsRng;
-#[cfg(all(unix, not(target_os = "ios"), not(target_os = "openbsd")))]
+use mem;
+
+fn next_u32(mut fill_buf: &mut FnMut(&mut [u8])) -> u32 {
+ let mut buf: [u8; 4] = [0; 4];
+ fill_buf(&mut buf);
+ unsafe { mem::transmute::<[u8; 4], u32>(buf) }
+}
+
+fn next_u64(mut fill_buf: &mut FnMut(&mut [u8])) -> u64 {
+ let mut buf: [u8; 8] = [0; 8];
+ fill_buf(&mut buf);
+ unsafe { mem::transmute::<[u8; 8], u64>(buf) }
+}
+
+#[cfg(all(unix,
+ not(target_os = "ios"),
+ not(target_os = "openbsd"),
+ not(target_os = "freebsd")))]
mod imp {
use self::OsRngInner::*;
+ use super::{next_u32, next_u64};
use fs::File;
use io;
use libc;
- use mem;
use rand::Rng;
use rand::reader::ReaderRng;
use sys::os::errno;
}
}
- fn getrandom_next_u32() -> u32 {
- let mut buf: [u8; 4] = [0; 4];
- getrandom_fill_bytes(&mut buf);
- unsafe { mem::transmute::<[u8; 4], u32>(buf) }
- }
-
- fn getrandom_next_u64() -> u64 {
- let mut buf: [u8; 8] = [0; 8];
- getrandom_fill_bytes(&mut buf);
- unsafe { mem::transmute::<[u8; 8], u64>(buf) }
- }
-
#[cfg(all(target_os = "linux",
any(target_arch = "x86_64",
target_arch = "x86",
impl Rng for OsRng {
fn next_u32(&mut self) -> u32 {
match self.inner {
- OsGetrandomRng => getrandom_next_u32(),
+ OsGetrandomRng => next_u32(&mut getrandom_fill_bytes),
OsReaderRng(ref mut rng) => rng.next_u32(),
}
}
fn next_u64(&mut self) -> u64 {
match self.inner {
- OsGetrandomRng => getrandom_next_u64(),
+ OsGetrandomRng => next_u64(&mut getrandom_fill_bytes),
OsReaderRng(ref mut rng) => rng.next_u64(),
}
}
#[cfg(target_os = "openbsd")]
mod imp {
+ use super::{next_u32, next_u64};
+
use io;
use libc;
- use mem;
use sys::os::errno;
use rand::Rng;
impl Rng for OsRng {
fn next_u32(&mut self) -> u32 {
- let mut v = [0; 4];
- self.fill_bytes(&mut v);
- unsafe { mem::transmute(v) }
+ next_u32(&mut |v| self.fill_bytes(v))
}
fn next_u64(&mut self) -> u64 {
- let mut v = [0; 8];
- self.fill_bytes(&mut v);
- unsafe { mem::transmute(v) }
+ next_u64(&mut |v| self.fill_bytes(v))
}
fn fill_bytes(&mut self, v: &mut [u8]) {
// getentropy(2) permits a maximum buffer size of 256 bytes
#[cfg(target_os = "ios")]
mod imp {
+ use super::{next_u32, next_u64};
+
use io;
- use mem;
use ptr;
use rand::Rng;
use libc::{c_int, size_t};
impl Rng for OsRng {
fn next_u32(&mut self) -> u32 {
- let mut v = [0; 4];
- self.fill_bytes(&mut v);
- unsafe { mem::transmute(v) }
+ next_u32(&mut |v| self.fill_bytes(v))
}
fn next_u64(&mut self) -> u64 {
- let mut v = [0; 8];
- self.fill_bytes(&mut v);
- unsafe { mem::transmute(v) }
+ next_u64(&mut |v| self.fill_bytes(v))
}
fn fill_bytes(&mut self, v: &mut [u8]) {
let ret = unsafe {
}
}
}
+
+#[cfg(target_os = "freebsd")]
+mod imp {
+ use super::{next_u32, next_u64};
+
+ use io;
+ use libc;
+ use rand::Rng;
+ use ptr;
+
+ pub struct OsRng {
+ // dummy field to ensure that this struct cannot be constructed outside
+ // of this module
+ _dummy: (),
+ }
+
+ impl OsRng {
+ /// Create a new `OsRng`.
+ pub fn new() -> io::Result<OsRng> {
+ Ok(OsRng { _dummy: () })
+ }
+ }
+
+ impl Rng for OsRng {
+ fn next_u32(&mut self) -> u32 {
+ next_u32(&mut |v| self.fill_bytes(v))
+ }
+ fn next_u64(&mut self) -> u64 {
+ next_u64(&mut |v| self.fill_bytes(v))
+ }
+ fn fill_bytes(&mut self, v: &mut [u8]) {
+ let mib = [libc::CTL_KERN, libc::KERN_ARND];
+ // kern.arandom permits a maximum buffer size of 256 bytes
+ for s in v.chunks_mut(256) {
+ let mut s_len = s.len();
+ let ret = unsafe {
+ libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint,
+ s.as_mut_ptr() as *mut _, &mut s_len,
+ ptr::null(), 0)
+ };
+ if ret == -1 || s_len != s.len() {
+ panic!("kern.arandom sysctl failed! (returned {}, s.len() {}, oldlenp {})",
+ ret, s.len(), s_len);
+ }
+ }
+ }
+ }
+}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use io;
use libc;
use sys::fd::FileDesc;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use alloc::boxed::FnBox;
use cmp;
use ffi::CStr;
target_os = "solaris"))]
#[cfg_attr(test, allow(dead_code))]
pub mod guard {
- use prelude::v1::*;
-
use libc;
use libc::mmap;
use libc::{PROT_NONE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED};
//! manner we pay a semi-large one-time cost up front for detecting whether a
//! function is available but afterwards it's just a load and a jump.
-use prelude::v1::*;
-
use ffi::CString;
use sync::atomic::{AtomicUsize, Ordering};
use sys::c;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::windows::prelude::*;
use ffi::{CString, OsStr};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::windows::prelude::*;
use ffi::OsString;
#![unstable(issue = "0", feature = "windows_handle")]
-use prelude::v1::*;
-
use cmp;
use io::{ErrorKind, Read};
use io;
#![allow(missing_docs, bad_style)]
-use prelude::v1::*;
-
use ffi::{OsStr, OsString};
use io::{self, ErrorKind};
use os::windows::ffi::{OsStrExt, OsStringExt};
//! CriticalSection is used and we keep track of who's holding the mutex to
//! detect recursive locks.
-use prelude::v1::*;
-
use cell::UnsafeCell;
use mem;
use sync::atomic::{AtomicUsize, Ordering};
#![unstable(issue = "0", feature = "windows_net")]
-use prelude::v1::*;
-
use cmp;
use io::{self, Read};
use libc::{c_int, c_void, c_ulong};
#![allow(bad_style)]
-use prelude::v1::*;
use os::windows::prelude::*;
use error::Error as StdError;
use borrow::Cow;
use fmt::{self, Debug};
use sys_common::wtf8::{Wtf8, Wtf8Buf};
-use string::String;
-use result::Result;
-use option::Option;
use mem;
use sys_common::{AsInner, IntoInner};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
use os::windows::prelude::*;
use ffi::OsStr;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use ascii::*;
use collections::HashMap;
use collections;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
use ffi::{OsStr, OsString};
use super::make_command_line;
#![unstable(issue = "0", feature = "windows_stdio")]
-use prelude::v1::*;
use io::prelude::*;
use cmp;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use alloc::boxed::FnBox;
use io;
use ffi::CStr;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use prelude::v1::*;
-
use ptr;
use sys::c;
use sys_common::mutex::Mutex;
// Due to rust-lang/rust#18804, make sure this is not generic!
#[cfg(target_os = "linux")]
unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) {
- use prelude::v1::*;
use mem;
use libc;
use sys_common::thread_local as os;
#[doc(hidden)]
pub mod os {
- use prelude::v1::*;
-
use cell::{Cell, UnsafeCell};
use marker;
use ptr;
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use sync::mpsc::{channel, Sender};
use cell::{Cell, UnsafeCell};
use super::LocalKeyState;
#[cfg(test)]
mod dynamic_tests {
- use prelude::v1::*;
-
use cell::RefCell;
use collections::HashMap;
#![stable(feature = "rust1", since = "1.0.0")]
-use prelude::v1::*;
-
use any::Any;
use cell::UnsafeCell;
use ffi::{CStr, CString};
#[cfg(test)]
mod tests {
- use prelude::v1::*;
-
use any::Any;
use sync::mpsc::{channel, Sender};
use result;
#[test]
fn test_spawn_sched() {
- use clone::Clone;
-
let (tx, rx) = channel();
fn f(i: i32, tx: Sender<()>) {
}
fn parent() {
- let file = File::open("Makefile").unwrap();
+ let file = File::open(file!()).unwrap();
let tcp1 = TcpListener::bind("127.0.0.1:0").unwrap();
let tcp2 = tcp1.try_clone().unwrap();
let addr = tcp1.local_addr().unwrap();