diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-07-29 17:01:14 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-03 17:23:01 -0700 |
| commit | 5cccf3cd256420d9f32c265e83036dea1d5f94d8 (patch) | |
| tree | 22904c7bb3df0872afa227638aa5e1e4ccb99fbc /src/libstd/lib.rs | |
| parent | ceded6adb3a4e172eabef09e1c78717a99c16b14 (diff) | |
| download | rust-5cccf3cd256420d9f32c265e83036dea1d5f94d8.tar.gz rust-5cccf3cd256420d9f32c265e83036dea1d5f94d8.zip | |
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
Diffstat (limited to 'src/libstd/lib.rs')
| -rw-r--r-- | src/libstd/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 2e796004aab..a694a9280dc 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -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)] |
