Index: crossbeam-channel/benches/crossbeam.rs
===================================================================
--- crossbeam-channel.orig/benches/crossbeam.rs
+++ crossbeam-channel/benches/crossbeam.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 #![feature(test)]
 
 extern crate test;
Index: crossbeam-channel/examples/fibonacci.rs
===================================================================
--- crossbeam-channel.orig/examples/fibonacci.rs
+++ crossbeam-channel/examples/fibonacci.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! An asynchronous fibonacci sequence generator.
 
 use std::thread;
Index: crossbeam-channel/examples/matching.rs
===================================================================
--- crossbeam-channel.orig/examples/matching.rs
+++ crossbeam-channel/examples/matching.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Using `select!` to send and receive on the same channel at the same time.
 //!
 //! This example is based on the following program in Go.
Index: crossbeam-channel/examples/stopwatch.rs
===================================================================
--- crossbeam-channel.orig/examples/stopwatch.rs
+++ crossbeam-channel/examples/stopwatch.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Prints the elapsed time every 1 second and quits on Ctrl+C.
 
 #[cfg(windows)] // signal_hook::iterator does not work on windows
Index: crossbeam-channel/tests/after.rs
===================================================================
--- crossbeam-channel.orig/tests/after.rs
+++ crossbeam-channel/tests/after.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the after channel flavor.
 
 #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
Index: crossbeam-channel/tests/array.rs
===================================================================
--- crossbeam-channel.orig/tests/array.rs
+++ crossbeam-channel/tests/array.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the array channel flavor.
 
 use std::any::Any;
Index: crossbeam-channel/tests/golang.rs
===================================================================
--- crossbeam-channel.orig/tests/golang.rs
+++ crossbeam-channel/tests/golang.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests copied from Go and manually rewritten in Rust.
 //!
 //! Source:
Index: crossbeam-channel/tests/iter.rs
===================================================================
--- crossbeam-channel.orig/tests/iter.rs
+++ crossbeam-channel/tests/iter.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for iteration over receivers.
 
 use crossbeam_channel::unbounded;
Index: crossbeam-channel/tests/list.rs
===================================================================
--- crossbeam-channel.orig/tests/list.rs
+++ crossbeam-channel/tests/list.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the list channel flavor.
 
 use std::any::Any;
Index: crossbeam-channel/tests/mpsc.rs
===================================================================
--- crossbeam-channel.orig/tests/mpsc.rs
+++ crossbeam-channel/tests/mpsc.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests copied from `std::sync::mpsc`.
 //!
 //! This is a copy of tests for the `std::sync::mpsc` channels from the standard library, but
@@ -29,16 +30,19 @@ use std::time::Duration;
 
 use crossbeam_channel as cc;
 
+#[cfg(feature = "std")]
 pub struct Sender<T> {
     pub inner: cc::Sender<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Sender<T> {
     pub fn send(&self, t: T) -> Result<(), SendError<T>> {
         self.inner.send(t).map_err(|cc::SendError(m)| SendError(m))
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> Clone for Sender<T> {
     fn clone(&self) -> Sender<T> {
         Sender {
@@ -47,10 +51,12 @@ impl<T> Clone for Sender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct SyncSender<T> {
     pub inner: cc::Sender<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> SyncSender<T> {
     pub fn send(&self, t: T) -> Result<(), SendError<T>> {
         self.inner.send(t).map_err(|cc::SendError(m)| SendError(m))
@@ -64,6 +70,7 @@ impl<T> SyncSender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> Clone for SyncSender<T> {
     fn clone(&self) -> SyncSender<T> {
         SyncSender {
@@ -72,10 +79,12 @@ impl<T> Clone for SyncSender<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct Receiver<T> {
     pub inner: cc::Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Receiver<T> {
     pub fn try_recv(&self) -> Result<T, TryRecvError> {
         self.inner.try_recv().map_err(|err| match err {
@@ -104,6 +113,7 @@ impl<T> Receiver<T> {
     }
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> IntoIterator for &'a Receiver<T> {
     type Item = T;
     type IntoIter = Iter<'a, T>;
@@ -113,6 +123,7 @@ impl<'a, T> IntoIterator for &'a Receive
     }
 }
 
+#[cfg(feature = "std")]
 impl<T> IntoIterator for Receiver<T> {
     type Item = T;
     type IntoIter = IntoIter<T>;
@@ -122,10 +133,12 @@ impl<T> IntoIterator for Receiver<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct TryIter<'a, T: 'a> {
     inner: &'a Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> Iterator for TryIter<'a, T> {
     type Item = T;
 
@@ -134,10 +147,12 @@ impl<'a, T> Iterator for TryIter<'a, T>
     }
 }
 
+#[cfg(feature = "std")]
 pub struct Iter<'a, T: 'a> {
     inner: &'a Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<'a, T> Iterator for Iter<'a, T> {
     type Item = T;
 
@@ -146,10 +161,12 @@ impl<'a, T> Iterator for Iter<'a, T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub struct IntoIter<T> {
     inner: Receiver<T>,
 }
 
+#[cfg(feature = "std")]
 impl<T> Iterator for IntoIter<T> {
     type Item = T;
 
@@ -158,6 +175,7 @@ impl<T> Iterator for IntoIter<T> {
     }
 }
 
+#[cfg(feature = "std")]
 pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
     let (s, r) = cc::unbounded();
     let s = Sender { inner: s };
@@ -165,6 +183,7 @@ pub fn channel<T>() -> (Sender<T>, Recei
     (s, r)
 }
 
+#[cfg(feature = "std")]
 pub fn sync_channel<T>(bound: usize) -> (SyncSender<T>, Receiver<T>) {
     let (s, r) = cc::bounded(bound);
     let s = SyncSender { inner: s };
@@ -172,6 +191,7 @@ pub fn sync_channel<T>(bound: usize) ->
     (s, r)
 }
 
+#[cfg(feature = "std")]
 macro_rules! select {
     (
         $($name:pat = $rx:ident.$meth:ident() => $code:expr),+
@@ -202,6 +222,7 @@ mod channel_tests {
         }
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke() {
         let (tx, rx) = channel::<i32>();
@@ -209,12 +230,14 @@ mod channel_tests {
         assert_eq!(rx.recv().unwrap(), 1);
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn drop_full() {
         let (tx, _rx) = channel::<Box<isize>>();
         tx.send(Box::new(1)).unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn drop_full_shared() {
         let (tx, _rx) = channel::<Box<isize>>();
@@ -223,6 +246,7 @@ mod channel_tests {
         tx.send(Box::new(1)).unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_shared() {
         let (tx, rx) = channel::<i32>();
@@ -233,6 +257,7 @@ mod channel_tests {
         assert_eq!(rx.recv().unwrap(), 1);
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_threads() {
         let (tx, rx) = channel::<i32>();
@@ -243,6 +268,7 @@ mod channel_tests {
         t.join().unwrap();
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_port_gone() {
         let (tx, rx) = channel::<i32>();
@@ -250,6 +276,7 @@ mod channel_tests {
         assert!(tx.send(1).is_err());
     }
 
+    #[cfg(feature = "std")]
     #[test]
     fn smoke_shared_port_gone() {
         let (tx, rx) = channel::<i32>();
@@ -1703,6 +1730,7 @@ mod sync_channel_tests {
 mod select_tests {
     use super::*;
 
+#[cfg(feature = "std")]
     use std::thread;
 
     #[test]
Index: crossbeam-channel/tests/never.rs
===================================================================
--- crossbeam-channel.orig/tests/never.rs
+++ crossbeam-channel/tests/never.rs
@@ -1,5 +1,5 @@
 //! Tests for the never channel flavor.
-
+#![cfg(feature = "std")]
 use std::thread;
 use std::time::{Duration, Instant};
 
Index: crossbeam-channel/tests/ready.rs
===================================================================
--- crossbeam-channel.orig/tests/ready.rs
+++ crossbeam-channel/tests/ready.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for channel readiness using the `Select` struct.
 
 use std::any::Any;
Index: crossbeam-channel/tests/same_channel.rs
===================================================================
--- crossbeam-channel.orig/tests/same_channel.rs
+++ crossbeam-channel/tests/same_channel.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 use std::time::Duration;
 
 use crossbeam_channel::{after, bounded, never, tick, unbounded};
Index: crossbeam-channel/tests/select.rs
===================================================================
--- crossbeam-channel.orig/tests/select.rs
+++ crossbeam-channel/tests/select.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for channel selection using the `Select` struct.
 
 use std::any::Any;
Index: crossbeam-channel/tests/select_macro.rs
===================================================================
--- crossbeam-channel.orig/tests/select_macro.rs
+++ crossbeam-channel/tests/select_macro.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the `select!` macro.
 
 #![forbid(unsafe_code)] // select! is safe.
Index: crossbeam-channel/tests/thread_locals.rs
===================================================================
--- crossbeam-channel.orig/tests/thread_locals.rs
+++ crossbeam-channel/tests/thread_locals.rs
@@ -1,5 +1,5 @@
 //! Tests that make sure accessing thread-locals while exiting the thread doesn't cause panics.
-
+#![cfg(feature = "std")]
 #![cfg(not(miri))] // Miri detects that this test is buggy: the destructor of `FOO` uses `std::thread::current()`!
 
 use std::thread;
Index: crossbeam-channel/tests/tick.rs
===================================================================
--- crossbeam-channel.orig/tests/tick.rs
+++ crossbeam-channel/tests/tick.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the tick channel flavor.
 
 #![cfg(not(miri))] // TODO: many assertions failed due to Miri is slow
Index: crossbeam-channel/tests/zero.rs
===================================================================
--- crossbeam-channel.orig/tests/zero.rs
+++ crossbeam-channel/tests/zero.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "std")]
 //! Tests for the zero channel flavor.
 
 use std::any::Any;
