1
Fork 0

syntax: Implement #![no_core]

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
This commit is contained in:
Alex Crichton 2015-07-29 17:01:14 -07:00
parent ceded6adb3
commit 5cccf3cd25
157 changed files with 478 additions and 385 deletions

View file

@ -71,7 +71,8 @@
use boxed::Box; use boxed::Box;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::atomic; use core::atomic;
use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst}; use core::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};

View file

@ -53,7 +53,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use heap; use heap;
use raw_vec::RawVec; use raw_vec::RawVec;

View file

@ -75,7 +75,6 @@
#![feature(coerce_unsized)] #![feature(coerce_unsized)]
#![feature(core)] #![feature(core)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_slice_ext)] #![feature(core_slice_ext)]
#![feature(custom_attribute)] #![feature(custom_attribute)]
#![feature(fundamental)] #![feature(fundamental)]
@ -93,17 +92,17 @@
#![feature(unsize)] #![feature(unsize)]
#![feature(core_slice_ext)] #![feature(core_slice_ext)]
#![feature(core_str_ext)] #![feature(core_str_ext)]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))] #![cfg_attr(test, feature(test, alloc, rustc_private, box_raw))]
#![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")), #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")),
feature(libc))] feature(libc))]
#[macro_use]
extern crate core;
#[cfg(all(not(feature = "external_funcs"), not(feature = "external_crate")))] #[cfg(all(not(feature = "external_funcs"), not(feature = "external_crate")))]
extern crate libc; extern crate libc;
#[cfg(stage0)] #[macro_use] extern crate core;
// Allow testing this library // Allow testing this library
#[cfg(test)] #[macro_use] extern crate std; #[cfg(test)] #[macro_use] extern crate std;

View file

@ -150,7 +150,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
#[cfg(not(test))] #[cfg(not(test))]
use boxed::Box; use boxed::Box;

View file

@ -151,7 +151,8 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::iter::{FromIterator}; use core::iter::{FromIterator};
use core::mem::swap; use core::mem::swap;

View file

@ -86,7 +86,8 @@
//! println!("There are {} primes below {}", num_primes, max_prime); //! 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::Ordering;
use core::cmp; use core::cmp;

View file

@ -17,7 +17,8 @@
use self::Entry::*; use self::Entry::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering; use core::cmp::Ordering;
use core::fmt::Debug; 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 /// to nodes. By using this module much better safety guarantees can be made, and more search
/// boilerplate gets cut out. /// boilerplate gets cut out.
mod stack { mod stack {
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::marker; use core::marker;
use core::mem; use core::mem;
use core::ops::{Deref, DerefMut}; use core::ops::{Deref, DerefMut};

View file

@ -16,7 +16,8 @@ pub use self::SearchResult::*;
pub use self::ForceResult::*; pub use self::ForceResult::*;
pub use self::TraversalItem::*; pub use self::TraversalItem::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering::{Greater, Less, Equal}; use core::cmp::Ordering::{Greater, Less, Equal};
use core::intrinsics::arith_offset; use core::intrinsics::arith_offset;

View file

@ -11,7 +11,8 @@
// This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface // This is pretty much entirely stolen from TreeSet, since BTreeMap has an identical interface
// to TreeMap // to TreeMap
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering::{self, Less, Greater, Equal}; use core::cmp::Ordering::{self, Less, Greater, Equal};
use core::fmt::Debug; use core::fmt::Debug;

View file

@ -17,7 +17,9 @@
reason = "matches collection reform specification, \ reason = "matches collection reform specification, \
waiting for dust to settle")] waiting for dust to settle")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::marker; use core::marker;
use core::fmt; use core::fmt;
use core::iter::{FromIterator}; use core::iter::{FromIterator};

View file

@ -33,9 +33,7 @@
#![feature(alloc)] #![feature(alloc)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(core)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_slice_ext)] #![feature(core_slice_ext)]
#![feature(core_str_ext)] #![feature(core_str_ext)]
#![feature(heap_api)] #![feature(heap_api)]
@ -62,12 +60,12 @@
#![feature(utf8_error)] #![feature(utf8_error)]
#![cfg_attr(test, feature(rand, test))] #![cfg_attr(test, feature(rand, test))]
#![cfg_attr(not(test), feature(str_words))] #![cfg_attr(not(test), feature(str_words))]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![feature(no_std)] #![feature(no_std)]
#![no_std] #![no_std]
#[macro_use] #[cfg(stage0)] #[macro_use] extern crate core;
extern crate core;
extern crate rustc_unicode; extern crate rustc_unicode;
extern crate alloc; extern crate alloc;

View file

@ -21,7 +21,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use alloc::boxed::Box; use alloc::boxed::Box;
use core::cmp::Ordering; use core::cmp::Ordering;

View file

@ -12,7 +12,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::fmt; use core::fmt;
use core::hash; use core::hash;

View file

@ -58,7 +58,9 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use alloc::raw_vec::RawVec; use alloc::raw_vec::RawVec;
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::heap::EMPTY; use alloc::heap::EMPTY;

View file

@ -18,7 +18,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::Ordering; use core::cmp::Ordering;
use core::fmt; use core::fmt;

View file

@ -20,7 +20,8 @@
use self::Entry::*; use self::Entry::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp::{max, Ordering}; use core::cmp::{max, Ordering};
use core::fmt; use core::fmt;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use prelude::*; use prelude::v1::*;
use fmt::{self, Write, FlagV1}; use fmt::{self, Write, FlagV1};
struct PadAdapter<'a, 'b: 'a> { struct PadAdapter<'a, 'b: 'a> {

View file

@ -12,7 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::*; use prelude::v1::*;
use cell::{Cell, RefCell, Ref, RefMut, BorrowState}; use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use marker::PhantomData; use marker::PhantomData;

View file

@ -12,7 +12,7 @@
// FIXME: #6220 Implement floating point formatting // FIXME: #6220 Implement floating point formatting
use prelude::*; use prelude::v1::*;
use fmt; use fmt;
use num::Zero; use num::Zero;

View file

@ -62,7 +62,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::*; use prelude::v1::*;
use mem; use mem;
@ -183,7 +183,7 @@ pub fn hash<T: Hash, H: Hasher + Default>(value: &T) -> u64 {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
mod impls { mod impls {
use prelude::*; use prelude::v1::*;
use slice; use slice;
use super::*; use super::*;

View file

@ -10,8 +10,9 @@
//! An implementation of SipHash 2-4. //! An implementation of SipHash 2-4.
use prelude::v1::*;
use ptr; use ptr;
use prelude::*;
use super::Hasher; use super::Hasher;
/// An implementation of SipHash 2-4. /// An implementation of SipHash 2-4.

View file

@ -60,8 +60,10 @@
html_playground_url = "http://play.rust-lang.org/")] html_playground_url = "http://play.rust-lang.org/")]
#![doc(test(no_crate_inject))] #![doc(test(no_crate_inject))]
#![feature(no_std)] #![cfg_attr(stage0, feature(no_std))]
#![no_std] #![cfg_attr(stage0, no_std)]
#![cfg_attr(not(stage0), feature(no_core))]
#![cfg_attr(not(stage0), no_core)]
#![allow(raw_pointer_derive)] #![allow(raw_pointer_derive)]
#![deny(missing_docs)] #![deny(missing_docs)]
@ -168,6 +170,7 @@ mod tuple;
// compiling the core library when it's compiling this library, so it expands // compiling the core library when it's compiling this library, so it expands
// all references to `::core::$foo` // all references to `::core::$foo`
#[doc(hidden)] #[doc(hidden)]
#[cfg(stage0)]
mod core { mod core {
pub use intrinsics; // derive(PartialOrd) pub use intrinsics; // derive(PartialOrd)
pub use fmt; // format_args! pub use fmt; // format_args!

View file

@ -15,7 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::*; use prelude::v1::*;
use intrinsics; use intrinsics;
use mem; use mem;

View file

@ -15,7 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use prelude::*; use prelude::v1::*;
use intrinsics; use intrinsics;
use mem; use mem;

View file

@ -21,7 +21,8 @@
#![macro_use] #![macro_use]
use prelude::*; use prelude::v1::*;
use mem; use mem;
use intrinsics; use intrinsics;
@ -351,7 +352,7 @@ define_bignum!(Big32x36: type=Digit32, n=36);
// this one is used for testing only. // this one is used for testing only.
#[doc(hidden)] #[doc(hidden)]
pub mod tests { pub mod tests {
use prelude::*; use prelude::v1::*;
define_bignum!(Big8x3: type=u8, n=3); define_bignum!(Big8x3: type=u8, n=3);
} }

View file

@ -10,7 +10,7 @@
//! Decodes a floating-point value into individual parts and error ranges. //! Decodes a floating-point value into individual parts and error ranges.
use prelude::*; use prelude::v1::*;
use {f32, f64}; use {f32, f64};
use num::{Float, FpCategory}; use num::{Float, FpCategory};

View file

@ -129,7 +129,7 @@ functions.
#![unstable(feature = "flt2dec", #![unstable(feature = "flt2dec",
reason = "internal routines only exposed for testing")] reason = "internal routines only exposed for testing")]
use prelude::*; use prelude::v1::*;
use i16; use i16;
use num::Float; use num::Float;
use slice::bytes; use slice::bytes;

View file

@ -15,7 +15,8 @@ Almost direct (but slightly optimized) Rust translation of Figure 3 of [1].
quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116. quickly and accurately. SIGPLAN Not. 31, 5 (May. 1996), 108-116.
*/ */
use prelude::*; use prelude::v1::*;
use num::Float; use num::Float;
use cmp::Ordering; use cmp::Ordering;

View file

@ -16,7 +16,8 @@ Rust adaptation of Grisu3 algorithm described in [1]. It uses about
accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243. accurately with integers. SIGPLAN Not. 45, 6 (June 2010), 233-243.
*/ */
use prelude::*; use prelude::v1::*;
use num::Float; use num::Float;
use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up}; use num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};

View file

@ -0,0 +1,13 @@
// 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;

View file

@ -11,18 +11,8 @@
//! The core prelude //! The core prelude
//! //!
//! This module is intended for users of libcore which do not link to libstd as //! 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 //! well. This module is imported by default when `#![no_std]` is used in the
//! of this module will provide all of the useful traits and types in libcore //! same manner as the standard library's prelude.
//! 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::*;
//! ```
#![unstable(feature = "core_prelude", #![unstable(feature = "core_prelude",
reason = "the libcore prelude has not been scrutinized and \ reason = "the libcore prelude has not been scrutinized and \

View file

@ -16,7 +16,8 @@
#![unstable(feature = "pattern", #![unstable(feature = "pattern",
reason = "API not fully fleshed out and ready to be stabilized")] reason = "API not fully fleshed out and ready to be stabilized")]
use prelude::*; use prelude::v1::*;
use cmp; use cmp;
use usize; use usize;

View file

@ -14,7 +14,8 @@
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc", #![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc",
reason = "use `libc` from crates.io"))] 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"), staged_api)]
#![cfg_attr(not(feature = "cargo-build"), no_std)] #![cfg_attr(not(feature = "cargo-build"), no_std)]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", #![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)] #![allow(bad_style, raw_pointer_derive)]
#![cfg_attr(target_os = "nacl", allow(unused_imports))] #![cfg_attr(target_os = "nacl", allow(unused_imports))]
#[cfg(feature = "cargo-build")] extern crate std as core; #[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 std;
#[cfg(test)] extern crate test; #[cfg(test)] extern crate test;

View file

@ -10,7 +10,9 @@
//! The ChaCha random number generator. //! The ChaCha random number generator.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use {Rng, SeedableRng, Rand}; use {Rng, SeedableRng, Rand};
const KEY_WORDS : usize = 8; // 8 words for the 256-bit key const KEY_WORDS : usize = 8; // 8 words for the 256-bit key

View file

@ -17,7 +17,9 @@
//! internally. The `IndependentSample` trait is for generating values //! internally. The `IndependentSample` trait is for generating values
//! that do not need to record state. //! that do not need to record state.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::num::Float; use core::num::Float;
use core::marker::PhantomData; use core::marker::PhantomData;

View file

@ -12,7 +12,8 @@
// this is surprisingly complicated to be both generic & correct // this is surprisingly complicated to be both generic & correct
use core::prelude::PartialOrd; #[cfg(stage0)]
use core::prelude::v1::PartialOrd;
use Rng; use Rng;
use distributions::{Sample, IndependentSample}; use distributions::{Sample, IndependentSample};

View file

@ -12,7 +12,9 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::slice; use core::slice;
use core::iter::repeat; use core::iter::repeat;
use core::num::Wrapping as w; use core::num::Wrapping as w;

View file

@ -28,26 +28,26 @@
#![staged_api] #![staged_api]
#![unstable(feature = "rand", #![unstable(feature = "rand",
reason = "use `rand` from crates.io")] reason = "use `rand` from crates.io")]
#![feature(core)]
#![feature(core_float)] #![feature(core_float)]
#![feature(core_prelude)]
#![feature(core_slice_ext)] #![feature(core_slice_ext)]
#![feature(no_std)] #![feature(no_std)]
#![feature(num_bits_bytes)] #![feature(num_bits_bytes)]
#![feature(staged_api)] #![feature(staged_api)]
#![feature(step_by)] #![feature(step_by)]
#![cfg_attr(stage0, feature(core, core_prelude))]
#![cfg_attr(test, feature(test, rand, rustc_private, iter_order))] #![cfg_attr(test, feature(test, rand, rustc_private, iter_order))]
#![allow(deprecated)] #![allow(deprecated)]
#[macro_use] #[cfg(stage0)] #[macro_use] extern crate core;
extern crate core;
#[cfg(test)] #[macro_use] extern crate std; #[cfg(test)] #[macro_use] extern crate std;
#[cfg(test)] #[macro_use] extern crate log; #[cfg(test)] #[macro_use] extern crate log;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::marker::PhantomData; use core::marker::PhantomData;
pub use isaac::{IsaacRng, Isaac64Rng}; pub use isaac::{IsaacRng, Isaac64Rng};

View file

@ -10,7 +10,9 @@
//! The implementations of `Rand` for the built-in types. //! The implementations of `Rand` for the built-in types.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::char; use core::char;
use core::isize; use core::isize;
use core::usize; use core::usize;

View file

@ -11,7 +11,8 @@
//! A wrapper around another RNG that reseeds it after it //! A wrapper around another RNG that reseeds it after it
//! generates a certain number of random bytes. //! generates a certain number of random bytes.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use {Rng, SeedableRng}; use {Rng, SeedableRng};

View file

@ -290,13 +290,6 @@ macro_rules! 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)] #[cfg(test)]
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
mod tests { mod tests {

View file

@ -46,7 +46,7 @@ struct RH<'a> {
sub: &'a [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 { struct ExpectErrorEmitter {
messages: Vec<String> messages: Vec<String>

View file

@ -33,17 +33,16 @@
test(no_crate_inject))] test(no_crate_inject))]
#![no_std] #![no_std]
#![feature(core)]
#![feature(core_char_ext)] #![feature(core_char_ext)]
#![feature(core_prelude)]
#![feature(core_slice_ext)] #![feature(core_slice_ext)]
#![feature(core_str_ext)] #![feature(core_str_ext)]
#![feature(iter_arith)] #![feature(iter_arith)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(no_std)] #![feature(no_std)]
#![feature(staged_api)] #![feature(staged_api)]
#![cfg_attr(stage0, feature(core, core_prelude))]
extern crate core; #[cfg(stage0)] extern crate core;
mod normalize; mod normalize;
mod tables; mod tables;

View file

@ -14,7 +14,8 @@
//! unicode parts of the CharExt trait. //! unicode parts of the CharExt trait.
use self::GraphemeState::*; use self::GraphemeState::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::char; use core::char;
use core::cmp; use core::cmp;

View file

@ -32,7 +32,8 @@
#![unstable(feature = "os_str", #![unstable(feature = "os_str",
reason = "recently added as part of path/io reform")] reason = "recently added as part of path/io reform")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use borrow::{Borrow, Cow, ToOwned}; use borrow::{Borrow, Cow, ToOwned};
use ffi::CString; use ffi::CString;

View file

@ -17,7 +17,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use fmt; use fmt;
use ffi::OsString; use ffi::OsString;

View file

@ -292,7 +292,8 @@ impl Write for Cursor<Vec<u8>> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*; use io::prelude::*;
use io::{Cursor, SeekFrom}; use io::{Cursor, SeekFrom};

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use boxed::Box; use boxed::Box;
use cmp; use cmp;

View file

@ -10,6 +10,7 @@
#![allow(missing_copy_implementations)] #![allow(missing_copy_implementations)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::{self, Read, Write, ErrorKind, BufRead}; use io::{self, Read, Write, ErrorKind, BufRead};

View file

@ -213,7 +213,6 @@
#![feature(core)] #![feature(core)]
#![feature(core_float)] #![feature(core_float)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(core_prelude)]
#![feature(core_simd)] #![feature(core_simd)]
#![feature(drain)] #![feature(drain)]
#![feature(fnbox)] #![feature(fnbox)]
@ -250,6 +249,7 @@
#![cfg_attr(test, feature(float_from_str_radix, range_inclusive, float_extras, hash_default))] #![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(test, feature(test, rustc_private, float_consts))]
#![cfg_attr(target_env = "msvc", feature(link_args))] #![cfg_attr(target_env = "msvc", feature(link_args))]
#![cfg_attr(stage0, feature(core, core_prelude))]
// Don't link to std. We are std. // Don't link to std. We are std.
#![no_std] #![no_std]
@ -257,13 +257,17 @@
#![allow(trivial_casts)] #![allow(trivial_casts)]
#![deny(missing_docs)] #![deny(missing_docs)]
#[cfg(stage0)] #[macro_use] extern crate core;
#[cfg(test)] extern crate test; #[cfg(test)] extern crate test;
#[cfg(test)] #[macro_use] extern crate log; #[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, #[macro_reexport(assert, assert_eq, debug_assert, debug_assert_eq,
unreachable, unimplemented, write, writeln)] unreachable, unimplemented, write, writeln)]
extern crate core; extern crate core as __core;
#[macro_use] #[macro_use]
#[macro_reexport(vec, format)] #[macro_reexport(vec, format)]

View file

@ -11,6 +11,7 @@
#![unstable(feature = "udp", reason = "remaining functions have not been \ #![unstable(feature = "udp", reason = "remaining functions have not been \
scrutinized enough to be stabilized")] scrutinized enough to be stabilized")]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use fmt; use fmt;

View file

@ -15,6 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use core::num; use core::num;

View file

@ -15,6 +15,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#![allow(missing_docs)] #![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use core::num; use core::num;

View file

@ -43,7 +43,8 @@ pub fn test_num<T>(ten: T, two: T) where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use super::*; use super::*;
use i8; use i8;
use i16; use i16;

View file

@ -98,7 +98,8 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use ascii::*; use ascii::*;
use borrow::{Borrow, IntoCow, ToOwned, Cow}; use borrow::{Borrow, IntoCow, ToOwned, Cow};
@ -134,7 +135,8 @@ use self::platform::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix};
#[cfg(unix)] #[cfg(unix)]
mod platform { mod platform {
use super::Prefix; use super::Prefix;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use ffi::OsStr; use ffi::OsStr;
#[inline] #[inline]
@ -157,7 +159,8 @@ mod platform {
#[cfg(windows)] #[cfg(windows)]
mod platform { mod platform {
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use ascii::*; use ascii::*;
use super::{os_str_as_u8_slice, u8_slice_as_os_str, Prefix}; use super::{os_str_as_u8_slice, u8_slice_as_os_str, Prefix};
@ -1747,7 +1750,8 @@ impl AsRef<Path> for PathBuf {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use string::{ToString, String}; use string::{ToString, String};
use vec::Vec; use vec::Vec;

View file

@ -57,6 +57,7 @@
#![unstable(feature = "rand")] #![unstable(feature = "rand")]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::RefCell; use cell::RefCell;

View file

@ -15,7 +15,7 @@ pub use self::imp::OsRng;
#[cfg(all(unix, not(target_os = "ios")))] #[cfg(all(unix, not(target_os = "ios")))]
mod imp { mod imp {
use prelude::v1::*; #[cfg(stage0)] use prelude::v1::*;
use self::OsRngInner::*; use self::OsRngInner::*;
use fs::File; use fs::File;
@ -251,6 +251,7 @@ mod imp {
#[cfg(windows)] #[cfg(windows)]
mod imp { mod imp {
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io; use io;

View file

@ -12,7 +12,7 @@
#![allow(dead_code)] #![allow(dead_code)]
use prelude::v1::*; #[cfg(stage0)] use prelude::v1::*;
use io::prelude::*; use io::prelude::*;
use rand::Rng; use rand::Rng;

View file

@ -19,7 +19,8 @@
//! //!
//! FIXME #7756: Would be nice for this to not exist. //! FIXME #7756: Would be nice for this to not exist.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use vec::Vec; use vec::Vec;
/// One-time global initialization. /// One-time global initialization.
@ -140,7 +141,8 @@ mod imp {
target_os = "ios", target_os = "ios",
target_os = "windows"))] target_os = "windows"))]
mod imp { mod imp {
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use vec::Vec; use vec::Vec;
pub unsafe fn init(_argc: isize, _argv: *const *const u8) { pub unsafe fn init(_argc: isize, _argv: *const *const u8) {

View file

@ -12,6 +12,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use env; use env;

View file

@ -39,7 +39,8 @@
outside in crates.io first")] outside in crates.io first")]
#![allow(deprecated)] #![allow(deprecated)]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::mem::replace; use core::mem::replace;
use boxed::Box; use boxed::Box;

View file

@ -265,6 +265,7 @@
// And now that you've seen all the races that I found and attempted to fix, // 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! // here's the code for you to find some more!
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use sync::Arc; use sync::Arc;

View file

@ -40,7 +40,8 @@
pub use self::PopResult::*; pub use self::PopResult::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use alloc::boxed::Box; use alloc::boxed::Box;
use core::ptr; use core::ptr;

View file

@ -37,7 +37,8 @@ pub use self::UpgradeResult::*;
pub use self::SelectionResult::*; pub use self::SelectionResult::*;
use self::MyUpgrade::*; use self::MyUpgrade::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use sync::mpsc::Receiver; use sync::mpsc::Receiver;
use sync::mpsc::blocking::{self, SignalToken}; use sync::mpsc::blocking::{self, SignalToken};

View file

@ -57,7 +57,8 @@
but no guarantees beyond this are being made")] but no guarantees beyond this are being made")]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cell::{Cell, UnsafeCell}; use core::cell::{Cell, UnsafeCell};
use core::marker; use core::marker;

View file

@ -20,7 +20,8 @@
pub use self::Failure::*; pub use self::Failure::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp; use core::cmp;
use core::isize; use core::isize;

View file

@ -33,7 +33,8 @@
//! concurrently between two threads. This data structure is safe to use and //! concurrently between two threads. This data structure is safe to use and
//! enforces the semantics that there is one pusher and one popper. //! 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 alloc::boxed::Box;
use core::ptr; use core::ptr;

View file

@ -22,7 +22,8 @@ pub use self::UpgradeResult::*;
pub use self::SelectionResult::*; pub use self::SelectionResult::*;
use self::Message::*; use self::Message::*;
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::cmp; use core::cmp;
use core::isize; use core::isize;

View file

@ -33,7 +33,8 @@
/// of a synchronous channel. There are a few branches for the unbuffered case, /// of a synchronous channel. There are a few branches for the unbuffered case,
/// but they're mostly just relevant to blocking senders. /// but they're mostly just relevant to blocking senders.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
pub use self::Failure::*; pub use self::Failure::*;
use self::Blocker::*; use self::Blocker::*;

View file

@ -13,6 +13,7 @@
//! This primitive is meant to be used to run one-time initialization. An //! This primitive is meant to be used to run one-time initialization. An
//! example use case would be for initializing an FFI library. //! example use case would be for initializing an FFI library.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use isize; use isize;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::prelude::*; use io::prelude::*;

View file

@ -10,6 +10,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
pub mod backtrace; pub mod backtrace;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::Cell; use cell::Cell;

View file

@ -10,7 +10,8 @@
#![allow(dead_code)] // stack_guard isn't used right now on all platforms #![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 cell::RefCell;
use string::String; use string::String;

View file

@ -58,6 +58,7 @@
#![unstable(feature = "thread_local_internals")] #![unstable(feature = "thread_local_internals")]
#![allow(dead_code)] // sys isn't exported yet #![allow(dead_code)] // sys isn't exported yet
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use sync::atomic::{self, AtomicUsize, Ordering}; use sync::atomic::{self, AtomicUsize, Ordering};

View file

@ -25,7 +25,8 @@
// unix (it's mostly used on windows), so don't worry about dead code here. // unix (it's mostly used on windows), so don't worry about dead code here.
#![allow(dead_code)] #![allow(dead_code)]
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use core::char::{encode_utf8_raw, encode_utf16_raw}; use core::char::{encode_utf8_raw, encode_utf16_raw};
use core::str::next_code_point; use core::str::next_code_point;

View file

@ -83,6 +83,7 @@
/// to symbols. This is a bit of a hokey implementation as-is, but it works for /// 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. /// all unix platforms we support right now, so it at least gets the job done.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::prelude::*; use io::prelude::*;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::UnsafeCell; use cell::UnsafeCell;

View file

@ -12,6 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use fs::{self, Permissions, OpenOptions}; use fs::{self, Permissions, OpenOptions};

View file

@ -14,6 +14,7 @@
use os::unix::raw::{uid_t, gid_t}; use os::unix::raw::{uid_t, gid_t};
use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd};
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use process; use process;
use sys; use sys;

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use io; use io;
use libc::{self, c_int, size_t, c_void}; use libc::{self, c_int, size_t, c_void};

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*; use io::prelude::*;
use os::unix::prelude::*; use os::unix::prelude::*;

View file

@ -11,6 +11,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::{self, ErrorKind}; use io::{self, ErrorKind};

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::UnsafeCell; use cell::UnsafeCell;

View file

@ -11,7 +11,8 @@
/// The underlying OsString/OsStr implementation on Unix systems: just /// The underlying OsString/OsStr implementation on Unix systems: just
/// a `Vec<u8>`/`[u8]`. /// a `Vec<u8>`/`[u8]`.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use borrow::Cow; use borrow::Cow;
use fmt::{self, Debug}; use fmt::{self, Debug};

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use sys::fd::FileDesc; use sys::fd::FileDesc;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use libc; use libc;

View file

@ -8,8 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use core::prelude::v1::*;
use libc; use libc;
use core::prelude::*;
use self::imp::{make_handler, drop_handler}; use self::imp::{make_handler, drop_handler};
pub use self::imp::{init, cleanup}; pub use self::imp::{init, cleanup};

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io; use io;

View file

@ -10,6 +10,7 @@
#![allow(dead_code)] // sys isn't exported yet #![allow(dead_code)] // sys isn't exported yet
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use libc::c_int; use libc::c_int;

View file

@ -24,6 +24,7 @@
#![allow(dead_code)] #![allow(dead_code)]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::prelude::*; use io::prelude::*;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::UnsafeCell; use cell::UnsafeCell;

View file

@ -12,6 +12,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use fs::{OpenOptions, Metadata}; use fs::{OpenOptions, Metadata};

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use io::prelude::*; use io::prelude::*;
use os::windows::prelude::*; use os::windows::prelude::*;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io::ErrorKind; use io::ErrorKind;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io; use io;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use io; use io;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use cell::UnsafeCell; use cell::UnsafeCell;

View file

@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use core::prelude::*; #[cfg(stage0)]
use core::prelude::v1::*;
use libc::types::os::arch::extra::{LPVOID, DWORD, LONG}; use libc::types::os::arch::extra::{LPVOID, DWORD, LONG};
use libc; use libc;

View file

@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
#[cfg(stage0)]
use prelude::v1::*; use prelude::v1::*;
use alloc::boxed::FnBox; use alloc::boxed::FnBox;

Some files were not shown because too many files have changed in this diff Show more