提交 dbe415a4 编写于 作者: B bors

Auto merge of #27393 - alexcrichton:no-std-changes, r=brson

This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184

Closes #27394
......@@ -71,7 +71,8 @@
use boxed::Box;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::atomic;
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
......
......@@ -53,7 +53,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use heap;
use raw_vec::RawVec;
......
......@@ -75,7 +75,6 @@
#![feature(coerce_unsized)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(custom_attribute)]
#![feature(fundamental)]
......@@ -93,17 +92,17 @@
#![feature(unsize)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
feature(libc))]
#[macro_use]
extern crate core;
#[cfg(all(not(feature = "external_funcs"), not(feature = "external_crate")))]
extern crate libc;
#[cfg(stage0)] #[macro_use] extern crate core;
// Allow testing this library
#[cfg(test)] #[macro_use] extern crate std;
......
......@@ -150,7 +150,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
#[cfg(not(test))]
use boxed::Box;
......
......@@ -151,7 +151,8 @@
#![allow(missing_docs)]
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::iter::{FromIterator};
use core::mem::swap;
......
......@@ -86,7 +86,8 @@
//! println!("There are {} primes below {}", num_primes, max_prime);
//! ```
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering;
use core::cmp;
......
......@@ -17,7 +17,8 @@
use self::Entry::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering;
use core::fmt::Debug;
......@@ -530,7 +531,8 @@ enum Continuation<A, B> {
/// to nodes. By using this module much better safety guarantees can be made, and more search
/// boilerplate gets cut out.
mod stack {
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::marker;
use core::mem;
use core::ops::{Deref, DerefMut};
......
......@@ -16,7 +16,8 @@
pub use self::ForceResult::*;
pub use self::TraversalItem::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering::{Greater, Less, Equal};
use core::intrinsics::arith_offset;
......
......@@ -11,7 +11,8 @@
// This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface
// to TreeMap
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering::{self, Less, Greater, Equal};
use core::fmt::Debug;
......
......@@ -17,7 +17,9 @@
reason = "matches collection reform specification, \
waiting for dust to settle")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::marker;
use core::fmt;
use core::iter::{FromIterator};
......
......@@ -33,9 +33,7 @@
#![feature(alloc)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(core)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(heap_api)]
......@@ -62,12 +60,12 @@
#![feature(utf8_error)]
#![cfg_attr(test, feature(rand, test))]
#![cfg_attr(not(test), feature(str_words))]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![feature(no_std)]
#![no_std]
#[macro_use]
extern crate core;
#[cfg(stage0)] #[macro_use] extern crate core;
extern crate rustc_unicode;
extern crate alloc;
......
......@@ -21,7 +21,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use alloc::boxed::Box;
use core::cmp::Ordering;
......
......@@ -12,7 +12,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::fmt;
use core::hash;
......
......@@ -58,7 +58,9 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use alloc::raw_vec::RawVec;
use alloc::boxed::Box;
use alloc::heap::EMPTY;
......
......@@ -18,7 +18,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering;
use core::fmt;
......
......@@ -20,7 +20,8 @@
use self::Entry::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::{max, Ordering};
use core::fmt;
......
......@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use prelude::*;
use prelude::v1::*;
use fmt::{self, Write, FlagV1};
struct PadAdapter<'a, 'b: 'a> {
......
......@@ -12,7 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use prelude::*;
use prelude::v1::*;
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use marker::PhantomData;
......
......@@ -12,7 +12,7 @@
// FIXME: #6220 Implement floating point formatting
use prelude::*;
use prelude::v1::*;
use fmt;
use num::Zero;
......
......@@ -62,7 +62,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use prelude::*;
use prelude::v1::*;
use mem;
......@@ -183,7 +183,7 @@ pub fn hash<T: Hash, H: Hasher + Default>(value: &T) -> u64 {
//////////////////////////////////////////////////////////////////////////////
mod impls {
use prelude::*;
use prelude::v1::*;
use slice;
use super::*;
......
......@@ -10,8 +10,9 @@
//! An implementation of SipHash 2-4.
use prelude::v1::*;
use ptr;
use prelude::*;
use super::Hasher;
/// An implementation of SipHash 2-4.
......
......@@ -60,8 +60,10 @@
html_playground_url = "http://play.rust-lang.org/")]
#![doc(test(no_crate_inject))]
#![feature(no_std)]
#![no_std]
#![cfg_attr(stage0, feature(no_std))]
#![cfg_attr(stage0, no_std)]
#![cfg_attr(not(stage0), feature(no_core))]
#![cfg_attr(not(stage0), no_core)]
#![allow(raw_pointer_derive)]
#![deny(missing_docs)]
......@@ -168,6 +170,7 @@
// compiling the core library when it's compiling this library, so it expands
// all references to `::core::$foo`
#[doc(hidden)]
#[cfg(stage0)]
mod core {
pub use intrinsics; // derive(PartialOrd)
pub use fmt; // format_args!
......
......@@ -15,7 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use prelude::*;
use prelude::v1::*;
use intrinsics;
use mem;
......
......@@ -15,7 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
use prelude::*;
use prelude::v1::*;
use intrinsics;
use mem;
......
......@@ -21,7 +21,8 @@
#![macro_use]
use prelude::*;
use prelude::v1::*;
use mem;
use intrinsics;
......@@ -351,7 +352,7 @@ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
// this one is used for testing only.
#[doc(hidden)]
pub mod tests {
use prelude::*;
use prelude::v1::*;
define_bignum!(Big8x3: type=u8, n=3);
}
......@@ -10,7 +10,7 @@
//! Decodes a floating-point value into individual parts and error ranges.
use prelude::*;
use prelude::v1::*;
use {f32, f64};
use num::{Float, FpCategory};
......
......@@ -129,7 +129,7 @@
#![unstable(feature = "flt2dec",
reason = "internal routines only exposed for testing")]
use prelude::*;
use prelude::v1::*;
use i16;
use num::Float;
use slice::bytes;
......
......@@ -15,7 +15,8 @@
quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116.
*/
use prelude::*;
use prelude::v1::*;
use num::Float;
use cmp::Ordering;
......
......@@ -16,7 +16,8 @@
accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243.
*/
use prelude::*;
use prelude::v1::*;
use num::Float;
use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};
......
// Copyright 2015 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.
//! The libcore prelude
pub mod v1;
......@@ -11,18 +11,8 @@
//! The core prelude
//!
//! This module is intended for users of libcore which do not link to libstd as
//! well. This module is not imported by default, but using the entire contents
//! of this module will provide all of the useful traits and types in libcore
//! that one would expect from the standard library as well.
//!
//! There is no method to automatically inject this prelude, and this prelude is
//! a subset of the standard library's prelude.
//!
//! # Example
//!
//! ```ignore
//! use core::prelude::*;
//! ```
//! well. This module is imported by default when `#![no_std]` is used in the
//! same manner as the standard library's prelude.
#![unstable(feature = "core_prelude",
reason = "the libcore prelude has not been scrutinized and \
......
......@@ -16,7 +16,8 @@
#![unstable(feature = "pattern",
reason = "API not fully fleshed out and ready to be stabilized")]
use prelude::*;
use prelude::v1::*;
use cmp;
use usize;
......
......@@ -14,7 +14,8 @@
#![crate_type = "rlib"]
#![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc",
reason = "use `libc` from crates.io"))]
#![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))]
#![cfg_attr(not(feature = "cargo-build"), feature(staged_api, no_std))]
#![cfg_attr(all(not(feature = "cargo-build"), stage0), feature(core))]
#![cfg_attr(not(feature = "cargo-build"), staged_api)]
#![cfg_attr(not(feature = "cargo-build"), no_std)]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
......@@ -78,7 +79,7 @@
#![allow(bad_style, raw_pointer_derive)]
#![cfg_attr(target_os = "nacl", allow(unused_imports))]
#[cfg(feature = "cargo-build")] extern crate std as core;
#[cfg(not(feature = "cargo-build"))] extern crate core;
#[cfg(all(stage0, not(feature = "cargo-build")))] extern crate core;
#[cfg(test)] extern crate std;
#[cfg(test)] extern crate test;
......
......@@ -10,7 +10,9 @@
//! The ChaCha random number generator.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use {Rng, SeedableRng, Rand};
const KEY_WORDS : usize = 8; // 8 words for the 256-bit key
......
......@@ -17,7 +17,9 @@
//! internally. The `IndependentSample` trait is for generating values
//! that do not need to record state.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::num::Float;
use core::marker::PhantomData;
......
......@@ -12,7 +12,8 @@
// this is surprisingly complicated to be both generic & correct
use core::prelude::PartialOrd;
#[cfg(stage0)]
use core::prelude::v1::PartialOrd;
use Rng;
use distributions::{Sample, IndependentSample};
......
......@@ -12,7 +12,9 @@
#![allow(non_camel_case_types)]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::slice;
use core::iter::repeat;
use core::num::Wrapping as w;
......
......@@ -28,26 +28,26 @@
#![staged_api]
#![unstable(feature = "rand",
reason = "use `rand` from crates.io")]
#![feature(core)]
#![feature(core_float)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(no_std)]
#![feature(num_bits_bytes)]
#![feature(staged_api)]
#![feature(step_by)]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![cfg_attr(test, feature(test, rand, rustc_private, iter_order))]
#![allow(deprecated)]
#[macro_use]
extern crate core;
#[cfg(stage0)] #[macro_use] extern crate core;
#[cfg(test)] #[macro_use] extern crate std;
#[cfg(test)] #[macro_use] extern crate log;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::marker::PhantomData;
pub use isaac::{IsaacRng, Isaac64Rng};
......
......@@ -10,7 +10,9 @@
//! The implementations of `Rand` for the built-in types.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::char;
use core::isize;
use core::usize;
......
......@@ -11,7 +11,8 @@
//! A wrapper around another RNG that reseeds it after it
//! generates a certain number of random bytes.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use {Rng, SeedableRng};
......
......@@ -290,13 +290,6 @@ fn not(self) -> $BitFlags {
};
}
// This is a no_std crate. So the test code's invocation of #[derive] etc, via
// bitflags!, will use names from the underlying crates.
#[cfg(test)]
mod core {
pub use std::{fmt, hash, clone, cmp, marker, option};
}
#[cfg(test)]
#[allow(non_upper_case_globals)]
mod tests {
......
......@@ -46,7 +46,7 @@ struct RH<'a> {
sub: &'a [RH<'a>]
}
const EMPTY_SOURCE_STR: &'static str = "#![feature(no_std)] #![no_std]";
const EMPTY_SOURCE_STR: &'static str = "#![feature(no_core)] #![no_core]";
struct ExpectErrorEmitter {
messages: Vec<String>
......
......@@ -33,17 +33,16 @@
test(no_crate_inject))]
#![no_std]
#![feature(core)]
#![feature(core_char_ext)]
#![feature(core_prelude)]
#![feature(core_slice_ext)]
#![feature(core_str_ext)]
#![feature(iter_arith)]
#![feature(lang_items)]
#![feature(no_std)]
#![feature(staged_api)]
#![cfg_attr(stage0, feature(core, core_prelude))]
extern crate core;
#[cfg(stage0)] extern crate core;
mod normalize;
mod tables;
......
......@@ -14,7 +14,8 @@
//! unicode parts of the CharExt trait.
use self::GraphemeState::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::char;
use core::cmp;
......
......@@ -32,7 +32,8 @@
#![unstable(feature = "os_str",
reason = "recently added as part of path/io reform")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use borrow::{Borrow, Cow, ToOwned};
use ffi::CString;
......
......@@ -17,7 +17,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use fmt;
use ffi::OsString;
......
......@@ -292,7 +292,8 @@ fn flush(&mut self) -> io::Result<()> { Ok(()) }
#[cfg(test)]
mod tests {
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*;
use io::{Cursor, SeekFrom};
......
......@@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use boxed::Box;
use cmp;
......
......@@ -10,6 +10,7 @@
#![allow(missing_copy_implementations)]
#[cfg(stage0)]
use prelude::v1::*;
use io::{self, Read, Write, ErrorKind, BufRead};
......
......@@ -213,7 +213,6 @@
#![feature(core)]
#![feature(core_float)]
#![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_simd)]
#![feature(drain)]
#![feature(fnbox)]
......@@ -250,6 +249,7 @@
#![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras, hash_default))]
#![cfg_attr(test, feature(test, rustc_private, float_consts))]
#![cfg_attr(target_env = "msvc", feature(link_args))]
#![cfg_attr(stage0, feature(core, core_prelude))]
// Don't link to std. We are std.
#![no_std]
......@@ -257,13 +257,17 @@
#![allow(trivial_casts)]
#![deny(missing_docs)]
#[cfg(stage0)] #[macro_use] extern crate core;
#[cfg(test)] extern crate test;
#[cfg(test)] #[macro_use] extern crate log;
#[macro_use]
// We want to reexport a few macros from core but libcore has already been
// imported by the compiler (via our #[no_std] attribute) In this case we just
// add a new crate name so we can attach the reexports to it.
#[macro_reexport(assert, assert_eq, debug_assert, debug_assert_eq,
unreachable, unimplemented, write, writeln)]
extern crate core;
extern crate core as __core;
#[macro_use]
#[macro_reexport(vec, format)]
......@@ -410,11 +414,3 @@ pub mod __rand {
// the rustdoc documentation for primitive types. Using `include!`
// because rustdoc only looks for these modules at the crate level.
include!("primitive_docs.rs");
// The expansion of --test has a few references to `::std::$foo` so this module
// is necessary to get things to compile.
#[cfg(test)]
mod std {
pub use option;
pub use realstd::env;
}
......@@ -11,6 +11,7 @@
#![unstable(feature = "udp", reason = "remaining functions have not been \
scrutinized enough to be stabilized")]
#[cfg(stage0)]
use prelude::v1::*;
use fmt;
......
......@@ -15,6 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*;
use core::num;
......
......@@ -15,6 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*;
use core::num;
......
......@@ -43,7 +43,8 @@ pub fn test_num<T>(ten: T, two: T) where
#[cfg(test)]
mod tests {
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use super::*;
use i8;
use i16;
......
......@@ -98,7 +98,8 @@
#![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use ascii::*;
use borrow::{Borrow, IntoCow, ToOwned, Cow};
......@@ -134,7 +135,8 @@
#[cfg(unix)]
mod platform {
use super::Prefix;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use ffi::OsStr;
#[inline]
......@@ -157,7 +159,8 @@ pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
#[cfg(windows)]
mod platform {
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use ascii::*;
use super::{os_str_as_u8_slice, u8_slice_as_os_str, Prefix};
......@@ -1747,7 +1750,8 @@ fn as_ref(&self) -> &Path { self }
#[cfg(test)]
mod tests {
use super::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use string::{ToString, String};
use vec::Vec;
......
......@@ -815,7 +815,7 @@ fn test_inherit_env() {
#[cfg(target_os="android")]
#[test]
fn test_inherit_env() {
use std::env;
use env;
let mut result = env_cmd().output().unwrap();
let output = String::from_utf8(result.stdout).unwrap();
......
......@@ -57,6 +57,7 @@
#![unstable(feature = "rand")]
#[cfg(stage0)]
use prelude::v1::*;
use cell::RefCell;
......
......@@ -15,7 +15,7 @@
#[cfg(all(unix, not(target_os = "ios")))]
mod imp {
use prelude::v1::*;
#[cfg(stage0)] use prelude::v1::*;
use self::OsRngInner::*;
use fs::File;
......@@ -251,6 +251,7 @@ fn fill_bytes(&mut self, v: &mut [u8]) {
#[cfg(windows)]
mod imp {
#[cfg(stage0)]
use prelude::v1::*;
use io;
......
......@@ -12,7 +12,7 @@
#![allow(dead_code)]
use prelude::v1::*;
#[cfg(stage0)] use prelude::v1::*;
use io::prelude::*;
use rand::Rng;
......
......@@ -19,7 +19,8 @@
//!
//! FIXME #7756: Would be nice for this to not exist.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use vec::Vec;
/// One-time global initialization.
......@@ -140,7 +141,8 @@ fn smoke_test() {
target_os = "ios",
target_os = "windows"))]
mod imp {
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use vec::Vec;
pub unsafe fn init(_argc: isize, _argv: *const *const u8) {
......
......@@ -12,6 +12,7 @@
#![allow(non_camel_case_types)]
#[cfg(stage0)]
use prelude::v1::*;
use env;
......
......@@ -39,7 +39,8 @@
outside in crates.io first")]
#![allow(deprecated)]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::mem::replace;
use boxed::Box;
......
......@@ -265,6 +265,7 @@
// And now that you've seen all the races that I found and attempted to fix,
// here's the code for you to find some more!
#[cfg(stage0)]
use prelude::v1::*;
use sync::Arc;
......
......@@ -40,7 +40,8 @@
pub use self::PopResult::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use alloc::boxed::Box;
use core::ptr;
......
......@@ -37,7 +37,8 @@
pub use self::SelectionResult::*;
use self::MyUpgrade::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use sync::mpsc::Receiver;
use sync::mpsc::blocking::{self, SignalToken};
......
......@@ -57,7 +57,8 @@
but no guarantees beyond this are being made")]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cell::{Cell, UnsafeCell};
use core::marker;
......
......@@ -20,7 +20,8 @@
pub use self::Failure::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp;
use core::isize;
......
......@@ -33,7 +33,8 @@
//! concurrently between two threads. This data structure is safe to use and
//! enforces the semantics that there is one pusher and one popper.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use alloc::boxed::Box;
use core::ptr;
......
......@@ -22,7 +22,8 @@
pub use self::SelectionResult::*;
use self::Message::*;
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp;
use core::isize;
......
......@@ -33,7 +33,8 @@
/// of a synchronous channel. There are a few branches for the unbuffered case,
/// but they're mostly just relevant to blocking senders.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
pub use self::Failure::*;
use self::Blocker::*;
......
......@@ -13,6 +13,7 @@
//! This primitive is meant to be used to run one-time initialization. An
//! example use case would be for initializing an FFI library.
#[cfg(stage0)]
use prelude::v1::*;
use isize;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use io::prelude::*;
......
......@@ -10,6 +10,7 @@
#![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*;
pub mod backtrace;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use cell::Cell;
......
......@@ -10,7 +10,8 @@
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use cell::RefCell;
use string::String;
......
......@@ -58,6 +58,7 @@
#![unstable(feature = "thread_local_internals")]
#![allow(dead_code)] // sys isn't exported yet
#[cfg(stage0)]
use prelude::v1::*;
use sync::atomic::{self, AtomicUsize, Ordering};
......
......@@ -25,7 +25,8 @@
// unix (it's mostly used on windows), so don't worry about dead code here.
#![allow(dead_code)]
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use core::char::{encode_utf8_raw, encode_utf16_raw};
use core::str::next_code_point;
......
......@@ -83,6 +83,7 @@
/// to symbols. This is a bit of a hokey implementation as-is, but it works for
/// all unix platforms we support right now, so it at least gets the job done.
#[cfg(stage0)]
use prelude::v1::*;
use io::prelude::*;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use cell::UnsafeCell;
......
......@@ -12,6 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
use prelude::v1::*;
use fs::{self, Permissions, OpenOptions};
......
......@@ -14,6 +14,7 @@
use os::unix::raw::{uid_t, gid_t};
use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd};
#[cfg(stage0)]
use prelude::v1::*;
use process;
use sys;
......
......@@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use io;
use libc::{self, c_int, size_t, c_void};
......
......@@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*;
use os::unix::prelude::*;
......
......@@ -11,6 +11,7 @@
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#[cfg(stage0)]
use prelude::v1::*;
use io::{self, ErrorKind};
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use cell::UnsafeCell;
......
......@@ -11,7 +11,8 @@
/// The underlying OsString/OsStr implementation on Unix systems: just
/// a `Vec<u8>`/`[u8]`.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use borrow::Cow;
use fmt::{self, Debug};
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use sys::fd::FileDesc;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use libc;
......
......@@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use core::prelude::v1::*;
use libc;
use core::prelude::*;
use self::imp::{make_handler, drop_handler};
pub use self::imp::{init, cleanup};
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use io;
......
......@@ -166,6 +166,7 @@ fn drop(&mut self) {
not(target_os = "netbsd"),
not(target_os = "openbsd")))]
pub mod guard {
#[cfg(stage0)]
use prelude::v1::*;
pub unsafe fn current() -> Option<usize> { None }
......
......@@ -10,6 +10,7 @@
#![allow(dead_code)] // sys isn't exported yet
#[cfg(stage0)]
use prelude::v1::*;
use libc::c_int;
......
......@@ -24,6 +24,7 @@
#![allow(dead_code)]
#[cfg(stage0)]
use prelude::v1::*;
use io::prelude::*;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use cell::UnsafeCell;
......
......@@ -12,6 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
use prelude::v1::*;
use fs::{OpenOptions, Metadata};
......
......@@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::prelude::*;
#[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*;
use os::windows::prelude::*;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use io::ErrorKind;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use io;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use io;
......
......@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[cfg(stage0)]
use prelude::v1::*;
use cell::UnsafeCell;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册