about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-17 20:31:08 +0000
committerbors <bors@rust-lang.org>2015-01-17 20:31:08 +0000
commitf4f10dba2975b51c2d2c92157018db3ac13d4d4a (patch)
tree54bad6d9f9d3472c424b02ec91ff508a81ea1ffa /src/libstd
parent89c4e3792ddc5b45706ea0e919806a248f7a87c3 (diff)
parent6553c0f5eb7cb903b698431556ade4e954dcb4e6 (diff)
downloadrust-f4f10dba2975b51c2d2c92157018db3ac13d4d4a.tar.gz
rust-f4f10dba2975b51c2d2c92157018db3ac13d4d4a.zip
auto merge of #21300 : steveklabnik/rust/rollup, r=steveklabnik
manual rollup to fix some conflicts and diagnose why the test is failing...
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/bitflags.rs475
-rw-r--r--src/libstd/fmt.rs11
-rw-r--r--src/libstd/io/mod.rs27
-rw-r--r--src/libstd/io/net/pipe.rs2
-rw-r--r--src/libstd/io/net/tcp.rs6
-rw-r--r--src/libstd/io/timer.rs4
-rw-r--r--src/libstd/lib.rs7
-rw-r--r--src/libstd/macros.rs18
-rw-r--r--src/libstd/sync/future.rs16
9 files changed, 39 insertions, 527 deletions
diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs
deleted file mode 100644
index 3a059766fef..00000000000
--- a/src/libstd/bitflags.rs
+++ /dev/null
@@ -1,475 +0,0 @@
-// Copyright 2014 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.
-
-#![unstable]
-
-//! A typesafe bitmask flag generator.
-
-/// The `bitflags!` macro generates a `struct` that holds a set of C-style
-/// bitmask flags. It is useful for creating typesafe wrappers for C APIs.
-///
-/// The flags should only be defined for integer types, otherwise unexpected
-/// type errors may occur at compile time.
-///
-/// # Example
-///
-/// ```{.rust}
-/// bitflags! {
-///     flags Flags: u32 {
-///         const FLAG_A       = 0b00000001,
-///         const FLAG_B       = 0b00000010,
-///         const FLAG_C       = 0b00000100,
-///         const FLAG_ABC     = FLAG_A.bits
-///                            | FLAG_B.bits
-///                            | FLAG_C.bits,
-///     }
-/// }
-///
-/// fn main() {
-///     let e1 = FLAG_A | FLAG_C;
-///     let e2 = FLAG_B | FLAG_C;
-///     assert!((e1 | e2) == FLAG_ABC);   // union
-///     assert!((e1 & e2) == FLAG_C);     // intersection
-///     assert!((e1 - e2) == FLAG_A);     // set difference
-///     assert!(!e2 == FLAG_A);           // set complement
-/// }
-/// ```
-///
-/// The generated `struct`s can also be extended with type and trait implementations:
-///
-/// ```{.rust}
-/// use std::fmt;
-///
-/// bitflags! {
-///     flags Flags: u32 {
-///         const FLAG_A   = 0b00000001,
-///         const FLAG_B   = 0b00000010,
-///     }
-/// }
-///
-/// impl Flags {
-///     pub fn clear(&mut self) {
-///         self.bits = 0;  // The `bits` field can be accessed from within the
-///                         // same module where the `bitflags!` macro was invoked.
-///     }
-/// }
-///
-/// impl fmt::Show for Flags {
-///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-///         write!(f, "hi!")
-///     }
-/// }
-///
-/// fn main() {
-///     let mut flags = FLAG_A | FLAG_B;
-///     flags.clear();
-///     assert!(flags.is_empty());
-///     assert_eq!(format!("{:?}", flags).as_slice(), "hi!");
-/// }
-/// ```
-///
-/// # Attributes
-///
-/// Attributes can be attached to the generated `struct` by placing them
-/// before the `flags` keyword.
-///
-/// # Derived traits
-///
-/// The `PartialEq` and `Clone` traits are automatically derived for the `struct` using
-/// the `deriving` attribute. Additional traits can be derived by providing an
-/// explicit `deriving` attribute on `flags`.
-///
-/// # Operators
-///
-/// The following operator traits are implemented for the generated `struct`:
-///
-/// - `BitOr`: union
-/// - `BitAnd`: intersection
-/// - `BitXor`: toggle
-/// - `Sub`: set difference
-/// - `Not`: set complement
-///
-/// # Methods
-///
-/// The following methods are defined for the generated `struct`:
-///
-/// - `empty`: an empty set of flags
-/// - `all`: the set of all flags
-/// - `bits`: the raw value of the flags currently stored
-/// - `from_bits`: convert from underlying bit representation, unless that
-///                representation contains bits that do not correspond to a flag
-/// - `from_bits_truncate`: convert from underlying bit representation, dropping
-///                         any bits that do not correspond to flags
-/// - `is_empty`: `true` if no flags are currently stored
-/// - `is_all`: `true` if all flags are currently set
-/// - `intersects`: `true` if there are flags common to both `self` and `other`
-/// - `contains`: `true` all of the flags in `other` are contained within `self`
-/// - `insert`: inserts the specified flags in-place
-/// - `remove`: removes the specified flags in-place
-/// - `toggle`: the specified flags will be inserted if not present, and removed
-///             if they are.
-#[macro_export]
-macro_rules! bitflags {
-    ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
-        $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+
-    }) => {
-        #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
-        $(#[$attr])*
-        pub struct $BitFlags {
-            bits: $T,
-        }
-
-        $($(#[$Flag_attr])* pub const $Flag: $BitFlags = $BitFlags { bits: $value };)+
-
-        impl $BitFlags {
-            /// Returns an empty set of flags.
-            #[inline]
-            pub fn empty() -> $BitFlags {
-                $BitFlags { bits: 0 }
-            }
-
-            /// Returns the set containing all flags.
-            #[inline]
-            pub fn all() -> $BitFlags {
-                $BitFlags { bits: $($value)|+ }
-            }
-
-            /// Returns the raw value of the flags currently stored.
-            #[inline]
-            pub fn bits(&self) -> $T {
-                self.bits
-            }
-
-            /// Convert from underlying bit representation, unless that
-            /// representation contains bits that do not correspond to a flag.
-            #[inline]
-            pub fn from_bits(bits: $T) -> ::std::option::Option<$BitFlags> {
-                if (bits & !$BitFlags::all().bits()) != 0 {
-                    ::std::option::Option::None
-                } else {
-                    ::std::option::Option::Some($BitFlags { bits: bits })
-                }
-            }
-
-            /// Convert from underlying bit representation, dropping any bits
-            /// that do not correspond to flags.
-            #[inline]
-            pub fn from_bits_truncate(bits: $T) -> $BitFlags {
-                $BitFlags { bits: bits } & $BitFlags::all()
-            }
-
-            /// Returns `true` if no flags are currently stored.
-            #[inline]
-            pub fn is_empty(&self) -> bool {
-                *self == $BitFlags::empty()
-            }
-
-            /// Returns `true` if all flags are currently set.
-            #[inline]
-            pub fn is_all(&self) -> bool {
-                *self == $BitFlags::all()
-            }
-
-            /// Returns `true` if there are flags common to both `self` and `other`.
-            #[inline]
-            pub fn intersects(&self, other: $BitFlags) -> bool {
-                !(*self & other).is_empty()
-            }
-
-            /// Returns `true` all of the flags in `other` are contained within `self`.
-            #[inline]
-            pub fn contains(&self, other: $BitFlags) -> bool {
-                (*self & other) == other
-            }
-
-            /// Inserts the specified flags in-place.
-            #[inline]
-            pub fn insert(&mut self, other: $BitFlags) {
-                self.bits |= other.bits;
-            }
-
-            /// Removes the specified flags in-place.
-            #[inline]
-            pub fn remove(&mut self, other: $BitFlags) {
-                self.bits &= !other.bits;
-            }
-
-            /// Toggles the specified flags in-place.
-            #[inline]
-            pub fn toggle(&mut self, other: $BitFlags) {
-                self.bits ^= other.bits;
-            }
-        }
-
-        impl ::std::ops::BitOr for $BitFlags {
-            type Output = $BitFlags;
-
-            /// Returns the union of the two sets of flags.
-            #[inline]
-            fn bitor(self, other: $BitFlags) -> $BitFlags {
-                $BitFlags { bits: self.bits | other.bits }
-            }
-        }
-
-        impl ::std::ops::BitXor for $BitFlags {
-            type Output = $BitFlags;
-
-            /// Returns the left flags, but with all the right flags toggled.
-            #[inline]
-            fn bitxor(self, other: $BitFlags) -> $BitFlags {
-                $BitFlags { bits: self.bits ^ other.bits }
-            }
-        }
-
-        impl ::std::ops::BitAnd for $BitFlags {
-            type Output = $BitFlags;
-
-            /// Returns the intersection between the two sets of flags.
-            #[inline]
-            fn bitand(self, other: $BitFlags) -> $BitFlags {
-                $BitFlags { bits: self.bits & other.bits }
-            }
-        }
-
-        impl ::std::ops::Sub for $BitFlags {
-            type Output = $BitFlags;
-
-            /// Returns the set difference of the two sets of flags.
-            #[inline]
-            fn sub(self, other: $BitFlags) -> $BitFlags {
-                $BitFlags { bits: self.bits & !other.bits }
-            }
-        }
-
-        impl ::std::ops::Not for $BitFlags {
-            type Output = $BitFlags;
-
-            /// Returns the complement of this set of flags.
-            #[inline]
-            fn not(self) -> $BitFlags {
-                $BitFlags { bits: !self.bits } & $BitFlags::all()
-            }
-        }
-    };
-    ($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
-        $($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+,
-    }) => {
-        bitflags! {
-            $(#[$attr])*
-            flags $BitFlags: $T {
-                $($(#[$Flag_attr])* const $Flag = $value),+
-            }
-        }
-    };
-}
-
-#[cfg(test)]
-#[allow(non_upper_case_globals)]
-mod tests {
-    use hash::{self, SipHasher};
-    use option::Option::{Some, None};
-
-    bitflags! {
-        #[doc = "> The first principle is that you must not fool yourself — and"]
-        #[doc = "> you are the easiest person to fool."]
-        #[doc = "> "]
-        #[doc = "> - Richard Feynman"]
-        flags Flags: u32 {
-            const FlagA       = 0b00000001,
-            #[doc = "<pcwalton> macros are way better at generating code than trans is"]
-            const FlagB       = 0b00000010,
-            const FlagC       = 0b00000100,
-            #[doc = "* cmr bed"]
-            #[doc = "* strcat table"]
-            #[doc = "<strcat> wait what?"]
-            const FlagABC     = FlagA.bits
-                               | FlagB.bits
-                               | FlagC.bits,
-        }
-    }
-
-    bitflags! {
-        flags AnotherSetOfFlags: i8 {
-            const AnotherFlag = -1_i8,
-        }
-    }
-
-    #[test]
-    fn test_bits(){
-        assert_eq!(Flags::empty().bits(), 0b00000000);
-        assert_eq!(FlagA.bits(), 0b00000001);
-        assert_eq!(FlagABC.bits(), 0b00000111);
-
-        assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00);
-        assert_eq!(AnotherFlag.bits(), !0_i8);
-    }
-
-    #[test]
-    fn test_from_bits() {
-        assert!(Flags::from_bits(0) == Some(Flags::empty()));
-        assert!(Flags::from_bits(0b1) == Some(FlagA));
-        assert!(Flags::from_bits(0b10) == Some(FlagB));
-        assert!(Flags::from_bits(0b11) == Some(FlagA | FlagB));
-        assert!(Flags::from_bits(0b1000) == None);
-
-        assert!(AnotherSetOfFlags::from_bits(!0_i8) == Some(AnotherFlag));
-    }
-
-    #[test]
-    fn test_from_bits_truncate() {
-        assert!(Flags::from_bits_truncate(0) == Flags::empty());
-        assert!(Flags::from_bits_truncate(0b1) == FlagA);
-        assert!(Flags::from_bits_truncate(0b10) == FlagB);
-        assert!(Flags::from_bits_truncate(0b11) == (FlagA | FlagB));
-        assert!(Flags::from_bits_truncate(0b1000) == Flags::empty());
-        assert!(Flags::from_bits_truncate(0b1001) == FlagA);
-
-        assert!(AnotherSetOfFlags::from_bits_truncate(0_i8) == AnotherSetOfFlags::empty());
-    }
-
-    #[test]
-    fn test_is_empty(){
-        assert!(Flags::empty().is_empty());
-        assert!(!FlagA.is_empty());
-        assert!(!FlagABC.is_empty());
-
-        assert!(!AnotherFlag.is_empty());
-    }
-
-    #[test]
-    fn test_is_all() {
-        assert!(Flags::all().is_all());
-        assert!(!FlagA.is_all());
-        assert!(FlagABC.is_all());
-
-        assert!(AnotherFlag.is_all());
-    }
-
-    #[test]
-    fn test_two_empties_do_not_intersect() {
-        let e1 = Flags::empty();
-        let e2 = Flags::empty();
-        assert!(!e1.intersects(e2));
-
-        assert!(AnotherFlag.intersects(AnotherFlag));
-    }
-
-    #[test]
-    fn test_empty_does_not_intersect_with_full() {
-        let e1 = Flags::empty();
-        let e2 = FlagABC;
-        assert!(!e1.intersects(e2));
-    }
-
-    #[test]
-    fn test_disjoint_intersects() {
-        let e1 = FlagA;
-        let e2 = FlagB;
-        assert!(!e1.intersects(e2));
-    }
-
-    #[test]
-    fn test_overlapping_intersects() {
-        let e1 = FlagA;
-        let e2 = FlagA | FlagB;
-        assert!(e1.intersects(e2));
-    }
-
-    #[test]
-    fn test_contains() {
-        let e1 = FlagA;
-        let e2 = FlagA | FlagB;
-        assert!(!e1.contains(e2));
-        assert!(e2.contains(e1));
-        assert!(FlagABC.contains(e2));
-
-        assert!(AnotherFlag.contains(AnotherFlag));
-    }
-
-    #[test]
-    fn test_insert(){
-        let mut e1 = FlagA;
-        let e2 = FlagA | FlagB;
-        e1.insert(e2);
-        assert!(e1 == e2);
-
-        let mut e3 = AnotherSetOfFlags::empty();
-        e3.insert(AnotherFlag);
-        assert!(e3 == AnotherFlag);
-    }
-
-    #[test]
-    fn test_remove(){
-        let mut e1 = FlagA | FlagB;
-        let e2 = FlagA | FlagC;
-        e1.remove(e2);
-        assert!(e1 == FlagB);
-
-        let mut e3 = AnotherFlag;
-        e3.remove(AnotherFlag);
-        assert!(e3 == AnotherSetOfFlags::empty());
-    }
-
-    #[test]
-    fn test_operators() {
-        let e1 = FlagA | FlagC;
-        let e2 = FlagB | FlagC;
-        assert!((e1 | e2) == FlagABC);     // union
-        assert!((e1 & e2) == FlagC);       // intersection
-        assert!((e1 - e2) == FlagA);       // set difference
-        assert!(!e2 == FlagA);             // set complement
-        assert!(e1 ^ e2 == FlagA | FlagB); // toggle
-        let mut e3 = e1;
-        e3.toggle(e2);
-        assert!(e3 == FlagA | FlagB);
-
-        let mut m4 = AnotherSetOfFlags::empty();
-        m4.toggle(AnotherSetOfFlags::empty());
-        assert!(m4 == AnotherSetOfFlags::empty());
-    }
-
-    #[test]
-    fn test_lt() {
-        let mut a = Flags::empty();
-        let mut b = Flags::empty();
-
-        assert!(!(a < b) && !(b < a));
-        b = FlagB;
-        assert!(a < b);
-        a = FlagC;
-        assert!(!(a < b) && b < a);
-        b = FlagC | FlagB;
-        assert!(a < b);
-    }
-
-    #[test]
-    fn test_ord() {
-        let mut a = Flags::empty();
-        let mut b = Flags::empty();
-
-        assert!(a <= b && a >= b);
-        a = FlagA;
-        assert!(a > b && a >= b);
-        assert!(b < a && b <= a);
-        b = FlagB;
-        assert!(b > a && b >= a);
-        assert!(a < b && a <= b);
-    }
-
-    #[test]
-    fn test_hash() {
-      let mut x = Flags::empty();
-      let mut y = Flags::empty();
-      assert!(hash::hash::<Flags, SipHasher>(&x) == hash::hash::<Flags, SipHasher>(&y));
-      x = Flags::all();
-      y = FlagABC;
-      assert!(hash::hash::<Flags, SipHasher>(&x) == hash::hash::<Flags, SipHasher>(&y));
-    }
-}
diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs
index 907925e93d3..36afa0956d2 100644
--- a/src/libstd/fmt.rs
+++ b/src/libstd/fmt.rs
@@ -26,15 +26,13 @@
 //!
 //! Some examples of the `format!` extension are:
 //!
-//! ```rust
-//! # fn main() {
+//! ```
 //! format!("Hello");                  // => "Hello"
 //! format!("Hello, {}!", "world");    // => "Hello, world!"
 //! format!("The number is {}", 1i);   // => "The number is 1"
 //! format!("{:?}", (3i, 4i));         // => "(3i, 4i)"
 //! format!("{value}", value=4i);      // => "4"
 //! format!("{} {}", 1i, 2u);          // => "1 2"
-//! # }
 //! ```
 //!
 //! From these, you can see that the first argument is a format string. It is
@@ -83,12 +81,10 @@
 //!
 //! For example, the following `format!` expressions all use named argument:
 //!
-//! ```rust
-//! # fn main() {
+//! ```
 //! format!("{argument}", argument = "test");   // => "test"
 //! format!("{name} {}", 1i, name = 2i);        // => "2 1"
 //! format!("{a} {c} {b}", a="a", b='b', c=3i);  // => "a 3 b"
-//! # }
 //! ```
 //!
 //! It is illegal to put positional parameters (those without names) after
@@ -288,8 +284,6 @@
 //! use std::fmt;
 //! use std::io;
 //!
-//! # #[allow(unused_must_use)]
-//! # fn main() {
 //! fmt::format(format_args!("this returns {}", "String"));
 //!
 //! let some_writer: &mut io::Writer = &mut io::stdout();
@@ -299,7 +293,6 @@
 //!     write!(&mut io::stdout(), "{}", args);
 //! }
 //! my_fmt_fn(format_args!("or a {} too", "function"));
-//! # }
 //! ```
 //!
 //! The result of the `format_args!` macro is a value of type `fmt::Arguments`.
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index bab4dafd090..e2b71cd43af 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -934,16 +934,15 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -
 /// A `RefReader` is a struct implementing `Reader` which contains a reference
 /// to another reader. This is often useful when composing streams.
 ///
-/// # Example
+/// # Examples
 ///
 /// ```
-/// # fn main() {}
-/// # fn process_input<R: Reader>(r: R) {}
-/// # fn foo() {
 /// use std::io;
 /// use std::io::ByRefReader;
 /// use std::io::util::LimitReader;
 ///
+/// fn process_input<R: Reader>(r: R) {}
+///
 /// let mut stream = io::stdin();
 ///
 /// // Only allow the function to process at most one kilobyte of input
@@ -953,8 +952,6 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -
 /// }
 ///
 /// // 'stream' is still available for use here
-///
-/// # }
 /// ```
 pub struct RefReader<'a, R:'a> {
     /// The underlying reader which this is referencing
@@ -1269,12 +1266,11 @@ impl<'a> Writer for &'a mut (Writer+'a) {
 /// # Example
 ///
 /// ```
-/// # fn main() {}
-/// # fn process_input<R: Reader>(r: R) {}
-/// # fn foo () {
 /// use std::io::util::TeeReader;
 /// use std::io::{stdin, ByRefWriter};
 ///
+/// fn process_input<R: Reader>(r: R) {}
+///
 /// let mut output = Vec::new();
 ///
 /// {
@@ -1285,7 +1281,6 @@ impl<'a> Writer for &'a mut (Writer+'a) {
 /// }
 ///
 /// println!("input processed: {:?}", output);
-/// # }
 /// ```
 pub struct RefWriter<'a, W:'a> {
     /// The underlying writer which this is referencing
@@ -1705,19 +1700,19 @@ pub enum FileType {
 /// A structure used to describe metadata information about a file. This
 /// structure is created through the `stat` method on a `Path`.
 ///
-/// # Example
+/// # Examples
+///
+/// ```no_run
+/// # #![allow(unstable)]
+///
+/// use std::io::fs::PathExtensions;
 ///
-/// ```
-/// # use std::io::fs::PathExtensions;
-/// # fn main() {}
-/// # fn foo() {
 /// let info = match Path::new("foo.txt").stat() {
 ///     Ok(stat) => stat,
 ///     Err(e) => panic!("couldn't read foo.txt: {}", e),
 /// };
 ///
 /// println!("byte size: {}", info.size);
-/// # }
 /// ```
 #[derive(Copy, Hash)]
 pub struct FileStat {
diff --git a/src/libstd/io/net/pipe.rs b/src/libstd/io/net/pipe.rs
index 42d9fff6d15..61d164d21e3 100644
--- a/src/libstd/io/net/pipe.rs
+++ b/src/libstd/io/net/pipe.rs
@@ -168,9 +168,7 @@ impl UnixListener {
     /// # Example
     ///
     /// ```
-    /// # fn main() {}
     /// # fn foo() {
-    /// # #![allow(unused_must_use)]
     /// use std::io::net::pipe::UnixListener;
     /// use std::io::{Listener, Acceptor};
     ///
diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs
index 6a3f5fcb2c6..4978085fa4f 100644
--- a/src/libstd/io/net/tcp.rs
+++ b/src/libstd/io/net/tcp.rs
@@ -272,12 +272,10 @@ impl sys_common::AsInner<TcpStreamImp> for TcpStream {
 /// A structure representing a socket server. This listener is used to create a
 /// `TcpAcceptor` which can be used to accept sockets on a local port.
 ///
-/// # Example
+/// # Examples
 ///
-/// ```rust
-/// # fn main() { }
+/// ```
 /// # fn foo() {
-/// # #![allow(dead_code)]
 /// use std::io::{TcpListener, TcpStream};
 /// use std::io::{Acceptor, Listener};
 /// use std::thread::Thread;
diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs
index 8a0445be471..844a97dea2d 100644
--- a/src/libstd/io/timer.rs
+++ b/src/libstd/io/timer.rs
@@ -27,10 +27,9 @@ use sys::timer::Timer as TimerImp;
 /// period of time. Handles to this timer can also be created in the form of
 /// receivers which will receive notifications over time.
 ///
-/// # Example
+/// # Examples
 ///
 /// ```
-/// # fn main() {}
 /// # fn foo() {
 /// use std::io::Timer;
 /// use std::time::Duration;
@@ -54,7 +53,6 @@ use sys::timer::Timer as TimerImp;
 /// the `io::timer` module.
 ///
 /// ```
-/// # fn main() {}
 /// # fn foo() {
 /// use std::io::timer;
 /// use std::time::Duration;
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 182344452a4..2553bbdf523 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -111,7 +111,7 @@
 #![feature(box_syntax)]
 #![feature(old_impl_check)]
 #![feature(optin_builtin_traits)]
-#![allow(unknown_features)] #![feature(int_uint)]
+#![feature(int_uint)]
 
 // Don't link to std. We are std.
 #![no_std]
@@ -136,6 +136,8 @@ extern crate alloc;
 extern crate unicode;
 extern crate libc;
 
+#[macro_use] #[no_link] extern crate rustc_bitflags;
+
 // Make std testable by not duplicating lang items. See #2912
 #[cfg(test)] extern crate "std" as realstd;
 #[cfg(test)] pub use realstd::marker;
@@ -181,9 +183,6 @@ pub use unicode::char;
 #[macro_use]
 mod macros;
 
-#[macro_use]
-pub mod bitflags;
-
 mod rtdeps;
 
 /* The Prelude. */
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index a420c841d25..8a8d14c4f3a 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -122,16 +122,18 @@ macro_rules! try {
 /// receivers. It places no restrictions on the types of receivers given to
 /// this macro, this can be viewed as a heterogeneous select.
 ///
-/// # Example
+/// # Examples
 ///
 /// ```
 /// use std::thread::Thread;
-/// use std::sync::mpsc::channel;
+/// use std::sync::mpsc;
+///
+/// // two placeholder functions for now
+/// fn long_running_task() {}
+/// fn calculate_the_answer() -> u32 { 42 }
 ///
-/// let (tx1, rx1) = channel();
-/// let (tx2, rx2) = channel();
-/// # fn long_running_task() {}
-/// # fn calculate_the_answer() -> int { 42i }
+/// let (tx1, rx1) = mpsc::channel();
+/// let (tx2, rx2) = mpsc::channel();
 ///
 /// Thread::spawn(move|| { long_running_task(); tx1.send(()).unwrap(); });
 /// Thread::spawn(move|| { tx2.send(calculate_the_answer()).unwrap(); });
@@ -251,13 +253,13 @@ pub mod builtin {
     /// statement or expression position, meaning this macro may be difficult to
     /// use in some situations.
     ///
-    /// # Example
+    /// # Examples
     ///
     /// ```
     /// #![feature(concat_idents)]
     ///
     /// # fn main() {
-    /// fn foobar() -> int { 23 }
+    /// fn foobar() -> u32 { 23 }
     ///
     /// let f = concat_idents!(foo, bar);
     /// println!("{}", f());
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index 568c24446e7..36bbc5ff5b4 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -11,14 +11,18 @@
 //! A type representing values that may be computed concurrently and operations
 //! for working with them.
 //!
-//! # Example
+//! # Examples
 //!
-//! ```rust
+//! ```
 //! use std::sync::Future;
-//! # fn fib(n: uint) -> uint {42};
-//! # fn make_a_sandwich() {};
-//! let mut delayed_fib = Future::spawn(move|| { fib(5000) });
-//! make_a_sandwich();
+//!
+//! // a fake, for now
+//! fn fib(n: u32) -> u32 { 42 };
+//!
+//! let mut delayed_fib = Future::spawn(move || fib(5000));
+//!
+//! // do stuff...
+//!
 //! println!("fib(5000) = {}", delayed_fib.get())
 //! ```