about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-07-29 17:01:14 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-08-03 17:23:01 -0700
commit5cccf3cd256420d9f32c265e83036dea1d5f94d8 (patch)
tree22904c7bb3df0872afa227638aa5e1e4ccb99fbc /src/libstd/sync
parentceded6adb3a4e172eabef09e1c78717a99c16b14 (diff)
downloadrust-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/sync')
-rw-r--r--src/libstd/sync/future.rs3
-rw-r--r--src/libstd/sync/mpsc/mod.rs1
-rw-r--r--src/libstd/sync/mpsc/mpsc_queue.rs3
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs3
-rw-r--r--src/libstd/sync/mpsc/select.rs3
-rw-r--r--src/libstd/sync/mpsc/shared.rs3
-rw-r--r--src/libstd/sync/mpsc/spsc_queue.rs3
-rw-r--r--src/libstd/sync/mpsc/stream.rs3
-rw-r--r--src/libstd/sync/mpsc/sync.rs3
-rw-r--r--src/libstd/sync/once.rs1
10 files changed, 18 insertions, 8 deletions
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index b87a2756829..d0314da19d3 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -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;
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index d80d858e7a9..954edefcc45 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -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;
diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs
index d6d173e5e7e..f45032d327f 100644
--- a/src/libstd/sync/mpsc/mpsc_queue.rs
+++ b/src/libstd/sync/mpsc/mpsc_queue.rs
@@ -40,7 +40,8 @@
 
 pub use self::PopResult::*;
 
-use core::prelude::*;
+#[cfg(stage0)]
+use core::prelude::v1::*;
 
 use alloc::boxed::Box;
 use core::ptr;
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index 7e9c017617d..b84cb3b5472 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -37,7 +37,8 @@ pub use self::UpgradeResult::*;
 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};
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index ee1516342ad..1d31ac165f6 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -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;
diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs
index 41c79dd52c8..8c019395d30 100644
--- a/src/libstd/sync/mpsc/shared.rs
+++ b/src/libstd/sync/mpsc/shared.rs
@@ -20,7 +20,8 @@
 
 pub use self::Failure::*;
 
-use core::prelude::*;
+#[cfg(stage0)]
+use core::prelude::v1::*;
 
 use core::cmp;
 use core::isize;
diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs
index 3cf75de5a46..5c0db521007 100644
--- a/src/libstd/sync/mpsc/spsc_queue.rs
+++ b/src/libstd/sync/mpsc/spsc_queue.rs
@@ -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;
diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs
index 404814b4cd4..a9514da4698 100644
--- a/src/libstd/sync/mpsc/stream.rs
+++ b/src/libstd/sync/mpsc/stream.rs
@@ -22,7 +22,8 @@ pub use self::UpgradeResult::*;
 pub use self::SelectionResult::*;
 use self::Message::*;
 
-use core::prelude::*;
+#[cfg(stage0)]
+use core::prelude::v1::*;
 
 use core::cmp;
 use core::isize;
diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs
index 904eab1fd7e..7c9298fff2a 100644
--- a/src/libstd/sync/mpsc/sync.rs
+++ b/src/libstd/sync/mpsc/sync.rs
@@ -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::*;
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index 0bda6a975a2..53191e14bec 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -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;