about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-24 17:38:09 +0000
committerbors <bors@rust-lang.org>2015-03-24 17:38:09 +0000
commited810385045ab0db90303574ba3ea47dfa2a36d5 (patch)
tree161242c800aca625a26c56551fa5adb446c0089f /src/libstd
parent28a0b25f424090255966273994748a9f9901059f (diff)
parentd252d0ad5434bcf77076729ab766eeff98f20ead (diff)
downloadrust-ed810385045ab0db90303574ba3ea47dfa2a36d5.tar.gz
rust-ed810385045ab0db90303574ba3ea47dfa2a36d5.zip
Auto merge of #23654 - alexcrichton:rollup, r=alexcrichton
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/array.rs13
-rw-r--r--src/libstd/collections/hash/map.rs43
-rw-r--r--src/libstd/collections/hash/set.rs35
-rw-r--r--src/libstd/collections/mod.rs2
-rw-r--r--src/libstd/env.rs13
-rw-r--r--src/libstd/ffi/c_str.rs17
-rw-r--r--src/libstd/ffi/os_str.rs89
-rw-r--r--src/libstd/fs/mod.rs74
-rw-r--r--src/libstd/fs/tempdir.rs7
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/io/cursor.rs14
-rw-r--r--src/libstd/io/mod.rs6
-rw-r--r--src/libstd/lib.rs49
-rw-r--r--src/libstd/macros.rs4
-rw-r--r--src/libstd/net/addr.rs1
-rw-r--r--src/libstd/net/ip.rs1
-rw-r--r--src/libstd/net/mod.rs1
-rw-r--r--src/libstd/net/tcp.rs2
-rw-r--r--src/libstd/net/udp.rs1
-rw-r--r--src/libstd/num/f32.rs43
-rw-r--r--src/libstd/num/f64.rs41
-rw-r--r--src/libstd/num/mod.rs41
-rw-r--r--src/libstd/old_io/buffered.rs3
-rw-r--r--src/libstd/old_io/comm_adapters.rs2
-rw-r--r--src/libstd/old_io/extensions.rs4
-rw-r--r--src/libstd/old_io/fs.rs12
-rw-r--r--src/libstd/old_io/mem.rs4
-rw-r--r--src/libstd/old_io/mod.rs14
-rw-r--r--src/libstd/old_io/net/ip.rs1
-rw-r--r--src/libstd/old_io/net/pipe.rs2
-rw-r--r--src/libstd/old_io/net/tcp.rs5
-rw-r--r--src/libstd/old_io/net/udp.rs1
-rw-r--r--src/libstd/old_io/pipe.rs1
-rw-r--r--src/libstd/old_io/process.rs5
-rw-r--r--src/libstd/old_io/stdio.rs2
-rw-r--r--src/libstd/old_io/tempfile.rs1
-rw-r--r--src/libstd/old_io/timer.rs6
-rw-r--r--src/libstd/old_path/mod.rs32
-rw-r--r--src/libstd/old_path/windows.rs2
-rw-r--r--src/libstd/os.rs18
-rw-r--r--src/libstd/path.rs226
-rw-r--r--src/libstd/prelude/v1.rs4
-rw-r--r--src/libstd/process.rs8
-rw-r--r--src/libstd/rand/mod.rs7
-rw-r--r--src/libstd/rand/reader.rs1
-rw-r--r--src/libstd/sync/condvar.rs1
-rw-r--r--src/libstd/sync/future.rs1
-rw-r--r--src/libstd/sync/mpsc/mod.rs6
-rw-r--r--src/libstd/sync/mpsc/select.rs2
-rw-r--r--src/libstd/sync/mutex.rs2
-rw-r--r--src/libstd/sync/poison.rs8
-rw-r--r--src/libstd/sync/rwlock.rs1
-rw-r--r--src/libstd/sync/semaphore.rs1
-rw-r--r--src/libstd/sync/task_pool.rs1
-rw-r--r--src/libstd/sys/common/thread_info.rs4
-rw-r--r--src/libstd/sys/common/wtf8.rs79
-rw-r--r--src/libstd/sys/unix/fs2.rs3
-rw-r--r--src/libstd/sys/unix/os.rs8
-rw-r--r--src/libstd/sys/unix/thread.rs60
-rw-r--r--src/libstd/sys/windows/fs2.rs2
-rw-r--r--src/libstd/sys/windows/mod.rs4
-rw-r--r--src/libstd/sys/windows/os.rs5
-rw-r--r--src/libstd/thread/local.rs (renamed from src/libstd/thread_local/mod.rs)107
-rw-r--r--src/libstd/thread/mod.rs (renamed from src/libstd/thread.rs)66
-rw-r--r--src/libstd/thread/scoped.rs (renamed from src/libstd/thread_local/scoped.rs)29
65 files changed, 978 insertions, 272 deletions
diff --git a/src/libstd/array.rs b/src/libstd/array.rs
new file mode 100644
index 00000000000..a6b8cd71a3b
--- /dev/null
+++ b/src/libstd/array.rs
@@ -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 fixed-size array type (`[T; n]`).
+
+#![doc(primitive = "array")]
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 9139e182ce4..f9558b85825 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -538,6 +538,7 @@ impl<K, V, S> HashMap<K, V, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::collections::HashMap;
     /// use std::collections::hash_map::RandomState;
     ///
@@ -566,6 +567,7 @@ impl<K, V, S> HashMap<K, V, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::collections::HashMap;
     /// use std::collections::hash_map::RandomState;
     ///
@@ -981,6 +983,7 @@ impl<K, V, S> HashMap<K, V, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::collections::HashMap;
     ///
     /// let mut a = HashMap::new();
@@ -1088,7 +1091,7 @@ impl<K, V, S> HashMap<K, V, S>
     ///     Some(x) => *x = "b",
     ///     None => (),
     /// }
-    /// assert_eq!(map[1], "b");
+    /// assert_eq!(map[&1], "b");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
@@ -1111,7 +1114,7 @@ impl<K, V, S> HashMap<K, V, S>
     ///
     /// map.insert(37, "b");
     /// assert_eq!(map.insert(37, "c"), Some("b"));
-    /// assert_eq!(map[37], "c");
+    /// assert_eq!(map[&37], "c");
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn insert(&mut self, k: K, v: V) -> Option<V> {
@@ -1244,6 +1247,7 @@ impl<K, V, S> Default for HashMap<K, V, S>
     }
 }
 
+#[cfg(stage0)]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K, Q: ?Sized, V, S> Index<Q> for HashMap<K, V, S>
     where K: Eq + Hash + Borrow<Q>,
@@ -1258,6 +1262,21 @@ impl<K, Q: ?Sized, V, S> Index<Q> for HashMap<K, V, S>
     }
 }
 
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap<K, V, S>
+    where K: Eq + Hash + Borrow<Q>,
+          Q: Eq + Hash,
+          S: HashState,
+{
+    type Output = V;
+
+    #[inline]
+    fn index(&self, index: &Q) -> &V {
+        self.get(index).expect("no entry found for key")
+    }
+}
+
 /// HashMap iterator.
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct Iter<'a, K: 'a, V: 'a> {
@@ -1323,15 +1342,13 @@ pub struct Drain<'a, K: 'a, V: 'a> {
 }
 
 /// A view into a single occupied location in a HashMap.
-#[unstable(feature = "std_misc",
-           reason = "precise API still being fleshed out")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
     elem: FullBucket<K, V, &'a mut RawTable<K, V>>,
 }
 
 /// A view into a single empty location in a HashMap.
-#[unstable(feature = "std_misc",
-           reason = "precise API still being fleshed out")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub struct VacantEntry<'a, K: 'a, V: 'a> {
     hash: SafeHash,
     key: K,
@@ -1339,12 +1356,14 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
 }
 
 /// A view into a single location in a map, which may be vacant or occupied.
-#[unstable(feature = "std_misc",
-           reason = "precise API still being fleshed out")]
+#[stable(feature = "rust1", since = "1.0.0")]
 pub enum Entry<'a, K: 'a, V: 'a> {
     /// An occupied Entry.
+    #[stable(feature = "rust1", since = "1.0.0")]
     Occupied(OccupiedEntry<'a, K, V>),
+
     /// A vacant Entry.
+    #[stable(feature = "rust1", since = "1.0.0")]
     Vacant(VacantEntry<'a, K, V>),
 }
 
@@ -1465,10 +1484,10 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
     #[inline] fn len(&self) -> usize { self.inner.len() }
 }
 
-#[unstable(feature = "std_misc",
-           reason = "matches collection reform v2 specification, waiting for dust to settle")]
 impl<'a, K, V> Entry<'a, K, V> {
     /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant.
+    #[unstable(feature = "std_misc",
+               reason = "will soon be replaced by or_insert")]
     pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
         match self {
             Occupied(entry) => Ok(entry.into_mut()),
@@ -2185,7 +2204,7 @@ mod test_map {
         map.insert(2, 1);
         map.insert(3, 4);
 
-        assert_eq!(map[2], 1);
+        assert_eq!(map[&2], 1);
     }
 
     #[test]
@@ -2197,7 +2216,7 @@ mod test_map {
         map.insert(2, 1);
         map.insert(3, 4);
 
-        map[4];
+        map[&4];
     }
 
     #[test]
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index de3f080de82..0933b4f662a 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -145,6 +145,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::collections::HashSet;
     /// use std::collections::hash_map::RandomState;
     ///
@@ -169,6 +170,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::collections::HashSet;
     /// use std::collections::hash_map::RandomState;
     ///
@@ -295,6 +297,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
     /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
@@ -325,6 +328,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
     /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
@@ -351,6 +355,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
     /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
@@ -376,6 +381,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
     /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect();
@@ -458,6 +464,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     ///
     /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
@@ -477,6 +484,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     ///
     /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect();
@@ -498,6 +506,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     ///
     /// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect();
@@ -519,6 +528,7 @@ impl<T, S> HashSet<T, S>
     /// # Examples
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::collections::HashSet;
     ///
     /// let sub: HashSet<_> = [1, 2].iter().cloned().collect();
@@ -853,6 +863,9 @@ impl<T, S> IntoIterator for HashSet<T, S>
     }
 }
 
+impl<'a, K> Clone for Iter<'a, K> {
+    fn clone(&self) -> Iter<'a, K> { Iter { iter: self.iter.clone() } }
+}
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K> Iterator for Iter<'a, K> {
     type Item = &'a K;
@@ -889,6 +902,12 @@ impl<'a, K> ExactSizeIterator for Drain<'a, K> {
     fn len(&self) -> usize { self.iter.len() }
 }
 
+impl<'a, T, S> Clone for Intersection<'a, T, S> {
+    fn clone(&self) -> Intersection<'a, T, S> {
+        Intersection { iter: self.iter.clone(), ..*self }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T, S> Iterator for Intersection<'a, T, S>
     where T: Eq + Hash, S: HashState
@@ -912,6 +931,12 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
     }
 }
 
+impl<'a, T, S> Clone for Difference<'a, T, S> {
+    fn clone(&self) -> Difference<'a, T, S> {
+        Difference { iter: self.iter.clone(), ..*self }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T, S> Iterator for Difference<'a, T, S>
     where T: Eq + Hash, S: HashState
@@ -935,6 +960,12 @@ impl<'a, T, S> Iterator for Difference<'a, T, S>
     }
 }
 
+impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> {
+    fn clone(&self) -> SymmetricDifference<'a, T, S> {
+        SymmetricDifference { iter: self.iter.clone() }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
     where T: Eq + Hash, S: HashState
@@ -945,6 +976,10 @@ impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
     fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
 }
 
+impl<'a, T, S> Clone for Union<'a, T, S> {
+    fn clone(&self) -> Union<'a, T, S> { Union { iter: self.iter.clone() } }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T, S> Iterator for Union<'a, T, S>
     where T: Eq + Hash, S: HashState
diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs
index caada8ae50f..8d24f6b1916 100644
--- a/src/libstd/collections/mod.rs
+++ b/src/libstd/collections/mod.rs
@@ -300,6 +300,7 @@
 //! #### Counting the number of times each character in a string occurs
 //!
 //! ```
+//! # #![feature(collections)]
 //! use std::collections::btree_map::{BTreeMap, Entry};
 //!
 //! let mut count = BTreeMap::new();
@@ -327,6 +328,7 @@
 //! #### Tracking the inebriation of customers at a bar
 //!
 //! ```
+//! # #![feature(collections)]
 //! use std::collections::btree_map::{BTreeMap, Entry};
 //!
 //! // A client of the bar. They have an id and a blood alcohol level.
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 24882c7f7ab..71f072302fb 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -23,7 +23,7 @@ use error::Error;
 use ffi::{OsString, AsOsStr};
 use fmt;
 use io;
-use path::{AsPath, PathBuf};
+use path::{Path, PathBuf};
 use sync::atomic::{AtomicIsize, ATOMIC_ISIZE_INIT, Ordering};
 use sync::{StaticMutex, MUTEX_INIT};
 use sys::os as os_imp;
@@ -67,8 +67,8 @@ pub fn current_dir() -> io::Result<PathBuf> {
 /// println!("Successfully changed working directory to {}!", root.display());
 /// ```
 #[stable(feature = "env", since = "1.0.0")]
-pub fn set_current_dir<P: AsPath + ?Sized>(p: &P) -> io::Result<()> {
-    os_imp::chdir(p.as_path())
+pub fn set_current_dir<P: AsRef<Path> + ?Sized>(p: &P) -> io::Result<()> {
+    os_imp::chdir(p.as_ref())
 }
 
 static ENV_LOCK: StaticMutex = MUTEX_INIT;
@@ -327,12 +327,13 @@ pub struct JoinPathsError {
 /// # Examples
 ///
 /// ```
+/// # #![feature(convert)]
 /// use std::env;
 /// use std::path::PathBuf;
 ///
 /// if let Some(path) = env::var_os("PATH") {
 ///     let mut paths = env::split_paths(&path).collect::<Vec<_>>();
-///     paths.push(PathBuf::new("/home/xyz/bin"));
+///     paths.push(PathBuf::from("/home/xyz/bin"));
 ///     let new_path = env::join_paths(paths.iter()).unwrap();
 ///     env::set_var("PATH", &new_path);
 /// }
@@ -833,7 +834,7 @@ mod tests {
     fn split_paths_windows() {
         fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
             split_paths(unparsed).collect::<Vec<_>>() ==
-                parsed.iter().map(|s| PathBuf::new(*s)).collect::<Vec<_>>()
+                parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
         }
 
         assert!(check_parse("", &mut [""]));
@@ -853,7 +854,7 @@ mod tests {
     fn split_paths_unix() {
         fn check_parse(unparsed: &str, parsed: &[&str]) -> bool {
             split_paths(unparsed).collect::<Vec<_>>() ==
-                parsed.iter().map(|s| PathBuf::new(*s)).collect::<Vec<_>>()
+                parsed.iter().map(|s| PathBuf::from(*s)).collect::<Vec<_>>()
         }
 
         assert!(check_parse("", &mut [""]));
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index fc4f03ff3a5..8b19d160172 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -10,6 +10,7 @@
 
 #![unstable(feature = "std_misc")]
 
+use convert::Into;
 use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
 use error::{Error, FromError};
 use fmt;
@@ -44,6 +45,7 @@ use vec::Vec;
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(libc)]
 /// # extern crate libc;
 /// # fn main() {
 /// use std::ffi::CString;
@@ -82,6 +84,7 @@ pub struct CString {
 /// Inspecting a foreign C string
 ///
 /// ```no_run
+/// # #![feature(libc)]
 /// extern crate libc;
 /// use std::ffi::CStr;
 ///
@@ -98,6 +101,7 @@ pub struct CString {
 /// Passing a Rust-originating C string
 ///
 /// ```no_run
+/// # #![feature(libc)]
 /// extern crate libc;
 /// use std::ffi::{CString, CStr};
 ///
@@ -130,6 +134,8 @@ pub struct NulError(usize, Vec<u8>);
 
 /// A conversion trait used by the constructor of `CString` for types that can
 /// be converted to a vector of bytes.
+#[deprecated(since = "1.0.0", reason = "use std::convert::Into<Vec<u8>> instead")]
+#[unstable(feature = "std_misc")]
 pub trait IntoBytes {
     /// Consumes this container, returning a vector of bytes.
     fn into_bytes(self) -> Vec<u8>;
@@ -144,6 +150,7 @@ impl CString {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(libc)]
     /// extern crate libc;
     /// use std::ffi::CString;
     ///
@@ -163,8 +170,8 @@ impl CString {
     /// internal 0 byte. The error returned will contain the bytes as well as
     /// the position of the nul byte.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn new<T: IntoBytes>(t: T) -> Result<CString, NulError> {
-        let bytes = t.into_bytes();
+    pub fn new<T: Into<Vec<u8>>>(t: T) -> Result<CString, NulError> {
+        let bytes = t.into();
         match bytes.iter().position(|x| *x == 0) {
             Some(i) => Err(NulError(i, bytes)),
             None => Ok(unsafe { CString::from_vec_unchecked(bytes) }),
@@ -179,6 +186,7 @@ impl CString {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(libc)]
     /// extern crate libc;
     /// use std::ffi::CString;
     ///
@@ -329,6 +337,7 @@ impl CStr {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(libc)]
     /// # extern crate libc;
     /// # fn main() {
     /// use std::ffi::CStr;
@@ -433,15 +442,19 @@ pub unsafe fn c_str_to_bytes_with_nul<'a>(raw: &'a *const libc::c_char)
     slice::from_raw_parts(*(raw as *const _ as *const *const u8), len as usize)
 }
 
+#[allow(deprecated)]
 impl<'a> IntoBytes for &'a str {
     fn into_bytes(self) -> Vec<u8> { self.as_bytes().to_vec() }
 }
+#[allow(deprecated)]
 impl<'a> IntoBytes for &'a [u8] {
     fn into_bytes(self) -> Vec<u8> { self.to_vec() }
 }
+#[allow(deprecated)]
 impl IntoBytes for String {
     fn into_bytes(self) -> Vec<u8> { self.into_bytes() }
 }
+#[allow(deprecated)]
 impl IntoBytes for Vec<u8> {
     fn into_bytes(self) -> Vec<u8> { self }
 }
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index feacbf1e98b..5851c6e2998 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -63,16 +63,18 @@ pub struct OsStr {
 impl OsString {
     /// Constructs an `OsString` at no cost by consuming a `String`.
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "use `from` instead")]
     pub fn from_string(s: String) -> OsString {
-        OsString { inner: Buf::from_string(s) }
+        OsString::from(s)
     }
 
     /// Constructs an `OsString` by copying from a `&str` slice.
     ///
     /// Equivalent to: `OsString::from_string(String::from_str(s))`.
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[deprecated(since = "1.0.0", reason = "use `from` instead")]
     pub fn from_str(s: &str) -> OsString {
-        OsString { inner: Buf::from_str(s) }
+        OsString::from(s)
     }
 
     /// Constructs a new empty `OsString`.
@@ -98,11 +100,40 @@ impl OsString {
 
     /// Extend the string with the given `&OsStr` slice.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn push<T: AsOsStr + ?Sized>(&mut self, s: &T) {
-        self.inner.push_slice(&s.as_os_str().inner)
+    pub fn push<T: AsRef<OsStr>>(&mut self, s: T) {
+        self.inner.push_slice(&s.as_ref().inner)
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl From<String> for OsString {
+    fn from(s: String) -> OsString {
+        OsString { inner: Buf::from_string(s) }
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a String> for OsString {
+    fn from(s: &'a String) -> OsString {
+        OsString { inner: Buf::from_str(s) }
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a str> for OsString {
+    fn from(s: &'a str) -> OsString {
+        OsString { inner: Buf::from_str(s) }
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a OsStr> for OsString {
+    fn from(s: &'a OsStr) -> OsString {
+        OsString { inner: s.inner.to_owned() }
     }
 }
 
+#[cfg(stage0)]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl ops::Index<ops::RangeFull> for OsString {
     type Output = OsStr;
@@ -113,6 +144,17 @@ impl ops::Index<ops::RangeFull> for OsString {
     }
 }
 
+#[cfg(not(stage0))]
+#[stable(feature = "rust1", since = "1.0.0")]
+impl ops::Index<ops::RangeFull> for OsString {
+    type Output = OsStr;
+
+    #[inline]
+    fn index(&self, _index: ops::RangeFull) -> &OsStr {
+        unsafe { mem::transmute(self.inner.as_slice()) }
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl ops::Deref for OsString {
     type Target = OsStr;
@@ -316,37 +358,76 @@ impl ToOwned for OsStr {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl<'a, T: AsOsStr + ?Sized> AsOsStr for &'a T {
     fn as_os_str(&self) -> &OsStr {
         (*self).as_os_str()
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for OsStr {
     fn as_os_str(&self) -> &OsStr {
         self
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for OsString {
     fn as_os_str(&self) -> &OsStr {
         &self[..]
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for str {
     fn as_os_str(&self) -> &OsStr {
         OsStr::from_str(self)
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for String {
     fn as_os_str(&self) -> &OsStr {
         OsStr::from_str(&self[..])
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for OsStr {
+    fn as_ref(&self) -> &OsStr {
+        self
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for OsString {
+    fn as_ref(&self) -> &OsStr {
+        self
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for str {
+    fn as_ref(&self) -> &OsStr {
+        OsStr::from_str(self)
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for String {
+    fn as_ref(&self) -> &OsStr {
+        OsStr::from_str(&self[..])
+    }
+}
+
 #[allow(deprecated)]
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for Path {
     #[cfg(unix)]
     fn as_os_str(&self) -> &OsStr {
diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs
index 7df6d6887a2..2546aace265 100644
--- a/src/libstd/fs/mod.rs
+++ b/src/libstd/fs/mod.rs
@@ -20,7 +20,7 @@
 use core::prelude::*;
 
 use io::{self, Error, ErrorKind, SeekFrom, Seek, Read, Write};
-use path::{AsPath, Path, PathBuf};
+use path::{Path, PathBuf};
 use sys::fs2 as fs_imp;
 use sys_common::{AsInnerMut, FromInner, AsInner};
 use vec::Vec;
@@ -129,7 +129,7 @@ impl File {
     /// This function will return an error if `path` does not already exist.
     /// Other errors may also be returned according to `OpenOptions::open`.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn open<P: AsPath>(path: P) -> io::Result<File> {
+    pub fn open<P: AsRef<Path>>(path: P) -> io::Result<File> {
         OpenOptions::new().read(true).open(path)
     }
 
@@ -140,7 +140,7 @@ impl File {
     ///
     /// See the `OpenOptions::open` function for more details.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn create<P: AsPath>(path: P) -> io::Result<File> {
+    pub fn create<P: AsRef<Path>>(path: P) -> io::Result<File> {
         OpenOptions::new().write(true).create(true).truncate(true).open(path)
     }
 
@@ -302,8 +302,8 @@ impl OpenOptions {
     ///   permissions for
     /// * Filesystem-level errors (full disk, etc)
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn open<P: AsPath>(&self, path: P) -> io::Result<File> {
-        let path = path.as_path();
+    pub fn open<P: AsRef<Path>>(&self, path: P) -> io::Result<File> {
+        let path = path.as_ref();
         let inner = try!(fs_imp::File::open(path, &self.0));
         Ok(File { path: path.to_path_buf(), inner: inner })
     }
@@ -415,8 +415,8 @@ impl DirEntry {
 /// user lacks permissions to remove the file, or if some other filesystem-level
 /// error occurs.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn remove_file<P: AsPath>(path: P) -> io::Result<()> {
-    fs_imp::unlink(path.as_path())
+pub fn remove_file<P: AsRef<Path>>(path: P) -> io::Result<()> {
+    fs_imp::unlink(path.as_ref())
 }
 
 /// Given a path, query the file system to get information about a file,
@@ -443,8 +443,8 @@ pub fn remove_file<P: AsPath>(path: P) -> io::Result<()> {
 /// permissions to perform a `metadata` call on the given `path` or if there
 /// is no entry in the filesystem at the provided path.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn metadata<P: AsPath>(path: P) -> io::Result<Metadata> {
-    fs_imp::stat(path.as_path()).map(Metadata)
+pub fn metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
+    fs_imp::stat(path.as_ref()).map(Metadata)
 }
 
 /// Rename a file or directory to a new name.
@@ -464,8 +464,8 @@ pub fn metadata<P: AsPath>(path: P) -> io::Result<Metadata> {
 /// reside on separate filesystems, or if some other intermittent I/O error
 /// occurs.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn rename<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<()> {
-    fs_imp::rename(from.as_path(), to.as_path())
+pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> {
+    fs_imp::rename(from.as_ref(), to.as_ref())
 }
 
 /// Copies the contents of one file to another. This function will also
@@ -494,9 +494,9 @@ pub fn rename<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<()> {
 /// * The current process does not have the permission rights to access
 ///   `from` or write `to`
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn copy<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<u64> {
-    let from = from.as_path();
-    let to = to.as_path();
+pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<u64> {
+    let from = from.as_ref();
+    let to = to.as_ref();
     if !from.is_file() {
         return Err(Error::new(ErrorKind::InvalidInput,
                               "the source path is not an existing file",
@@ -517,16 +517,16 @@ pub fn copy<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<u64> {
 /// The `dst` path will be a link pointing to the `src` path. Note that systems
 /// often require these two paths to both be located on the same filesystem.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn hard_link<P: AsPath, Q: AsPath>(src: P, dst: Q) -> io::Result<()> {
-    fs_imp::link(src.as_path(), dst.as_path())
+pub fn hard_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> {
+    fs_imp::link(src.as_ref(), dst.as_ref())
 }
 
 /// Creates a new soft link on the filesystem.
 ///
 /// The `dst` path will be a soft link pointing to the `src` path.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn soft_link<P: AsPath, Q: AsPath>(src: P, dst: Q) -> io::Result<()> {
-    fs_imp::symlink(src.as_path(), dst.as_path())
+pub fn soft_link<P: AsRef<Path>, Q: AsRef<Path>>(src: P, dst: Q) -> io::Result<()> {
+    fs_imp::symlink(src.as_ref(), dst.as_ref())
 }
 
 /// Reads a soft link, returning the file that the link points to.
@@ -537,8 +537,8 @@ pub fn soft_link<P: AsPath, Q: AsPath>(src: P, dst: Q) -> io::Result<()> {
 /// reading a file that does not exist or reading a file that is not a soft
 /// link.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn read_link<P: AsPath>(path: P) -> io::Result<PathBuf> {
-    fs_imp::readlink(path.as_path())
+pub fn read_link<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
+    fs_imp::readlink(path.as_ref())
 }
 
 /// Create a new, empty directory at the provided path
@@ -556,8 +556,8 @@ pub fn read_link<P: AsPath>(path: P) -> io::Result<PathBuf> {
 /// This function will return an error if the user lacks permissions to make a
 /// new directory at the provided `path`, or if the directory already exists.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn create_dir<P: AsPath>(path: P) -> io::Result<()> {
-    fs_imp::mkdir(path.as_path())
+pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
+    fs_imp::mkdir(path.as_ref())
 }
 
 /// Recursively create a directory and all of its parent components if they
@@ -570,9 +570,9 @@ pub fn create_dir<P: AsPath>(path: P) -> io::Result<()> {
 /// error conditions for when a directory is being created (after it is
 /// determined to not exist) are outlined by `fs::create_dir`.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn create_dir_all<P: AsPath>(path: P) -> io::Result<()> {
-    let path = path.as_path();
-    if path.is_dir() { return Ok(()) }
+pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
+    let path = path.as_ref();
+    if path == Path::new("") || path.is_dir() { return Ok(()) }
     if let Some(p) = path.parent() { try!(create_dir_all(p)) }
     create_dir(path)
 }
@@ -592,8 +592,8 @@ pub fn create_dir_all<P: AsPath>(path: P) -> io::Result<()> {
 /// This function will return an error if the user lacks permissions to remove
 /// the directory at the provided `path`, or if the directory isn't empty.
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn remove_dir<P: AsPath>(path: P) -> io::Result<()> {
-    fs_imp::rmdir(path.as_path())
+pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
+    fs_imp::rmdir(path.as_ref())
 }
 
 /// Removes a directory at this path, after removing all its contents. Use
@@ -606,8 +606,8 @@ pub fn remove_dir<P: AsPath>(path: P) -> io::Result<()> {
 ///
 /// See `file::remove_file` and `fs::remove_dir`
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn remove_dir_all<P: AsPath>(path: P) -> io::Result<()> {
-    let path = path.as_path();
+pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
+    let path = path.as_ref();
     for child in try!(read_dir(path)) {
         let child = try!(child).path();
         let stat = try!(lstat(&*child));
@@ -633,6 +633,7 @@ pub fn remove_dir_all<P: AsPath>(path: P) -> io::Result<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(path_ext)]
 /// use std::io;
 /// use std::fs::{self, PathExt, DirEntry};
 /// use std::path::Path;
@@ -659,8 +660,8 @@ pub fn remove_dir_all<P: AsPath>(path: P) -> io::Result<()> {
 /// the process lacks permissions to view the contents or if the `path` points
 /// at a non-directory file
 #[stable(feature = "rust1", since = "1.0.0")]
-pub fn read_dir<P: AsPath>(path: P) -> io::Result<ReadDir> {
-    fs_imp::readdir(path.as_path()).map(ReadDir)
+pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
+    fs_imp::readdir(path.as_ref()).map(ReadDir)
 }
 
 /// Returns an iterator that will recursively walk the directory structure
@@ -675,7 +676,7 @@ pub fn read_dir<P: AsPath>(path: P) -> io::Result<ReadDir> {
            reason = "the precise semantics and defaults for a recursive walk \
                      may change and this may end up accounting for files such \
                      as symlinks differently")]
-pub fn walk_dir<P: AsPath>(path: P) -> io::Result<WalkDir> {
+pub fn walk_dir<P: AsRef<Path>>(path: P) -> io::Result<WalkDir> {
     let start = try!(read_dir(path));
     Ok(WalkDir { cur: Some(start), stack: Vec::new() })
 }
@@ -761,9 +762,9 @@ impl PathExt for Path {
            reason = "the argument type of u64 is not quite appropriate for \
                      this function and may change if the standard library \
                      gains a type to represent a moment in time")]
-pub fn set_file_times<P: AsPath>(path: P, accessed: u64,
+pub fn set_file_times<P: AsRef<Path>>(path: P, accessed: u64,
                                  modified: u64) -> io::Result<()> {
-    fs_imp::utimes(path.as_path(), accessed, modified)
+    fs_imp::utimes(path.as_ref(), accessed, modified)
 }
 
 /// Changes the permissions found on a file or a directory.
@@ -771,6 +772,7 @@ pub fn set_file_times<P: AsPath>(path: P, accessed: u64,
 /// # Examples
 ///
 /// ```
+/// # #![feature(fs)]
 /// # fn foo() -> std::io::Result<()> {
 /// use std::fs;
 ///
@@ -790,8 +792,8 @@ pub fn set_file_times<P: AsPath>(path: P, accessed: u64,
            reason = "a more granual ability to set specific permissions may \
                      be exposed on the Permissions structure itself and this \
                      method may not always exist")]
-pub fn set_permissions<P: AsPath>(path: P, perm: Permissions) -> io::Result<()> {
-    fs_imp::set_perm(path.as_path(), perm.0)
+pub fn set_permissions<P: AsRef<Path>>(path: P, perm: Permissions) -> io::Result<()> {
+    fs_imp::set_perm(path.as_ref(), perm.0)
 }
 
 #[cfg(test)]
diff --git a/src/libstd/fs/tempdir.rs b/src/libstd/fs/tempdir.rs
index 8f32d7a5864..a9717e36323 100644
--- a/src/libstd/fs/tempdir.rs
+++ b/src/libstd/fs/tempdir.rs
@@ -18,7 +18,7 @@ use prelude::v1::*;
 use env;
 use io::{self, Error, ErrorKind};
 use fs;
-use path::{self, PathBuf, AsPath};
+use path::{self, PathBuf};
 use rand::{thread_rng, Rng};
 
 /// A wrapper for a path to temporary directory implementing automatic
@@ -43,10 +43,9 @@ impl TempDir {
     ///
     /// If no directory can be created, `Err` is returned.
     #[allow(deprecated)] // rand usage
-    pub fn new_in<P: AsPath + ?Sized>(tmpdir: &P, prefix: &str)
-                                      -> io::Result<TempDir> {
+    pub fn new_in<P: AsRef<path::Path>>(tmpdir: P, prefix: &str) -> io::Result<TempDir> {
         let storage;
-        let mut tmpdir = tmpdir.as_path();
+        let mut tmpdir = tmpdir.as_ref();
         if !tmpdir.is_absolute() {
             let cur_dir = try!(env::current_dir());
             storage = cur_dir.join(tmpdir);
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 43eec695274..4def601f1c0 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -258,7 +258,7 @@ impl<W> FromError<IntoInnerError<W>> for Error {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<W> error::Error for IntoInnerError<W> {
+impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
     fn description(&self) -> &str {
         error::Error::description(self.error())
     }
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs
index 87e5a2a4488..79f0af670b4 100644
--- a/src/libstd/io/cursor.rs
+++ b/src/libstd/io/cursor.rs
@@ -17,20 +17,18 @@ use iter::repeat;
 use num::Int;
 use slice;
 
-/// A `Cursor` is a type which wraps another I/O object to provide a `Seek`
+/// A `Cursor` is a type which wraps a non-I/O object to provide a `Seek`
 /// implementation.
 ///
-/// Cursors are currently typically used with memory buffer objects in order to
-/// allow `Seek` plus `Read` and `Write` implementations. For example, common
-/// cursor types include:
+/// Cursors are typically used with memory buffer objects in order to allow
+/// `Seek`, `Read`, and `Write` implementations. For example, common cursor types
+/// include `Cursor<Vec<u8>>` and `Cursor<&[u8]>`.
 ///
-/// * `Cursor<Vec<u8>>`
-/// * `Cursor<&[u8]>`
-///
-/// Implementations of the I/O traits for `Cursor<T>` are not currently generic
+/// Implementations of the I/O traits for `Cursor<T>` are currently not generic
 /// over `T` itself. Instead, specific implementations are provided for various
 /// in-memory buffer types like `Vec<u8>` and `&[u8]`.
 #[stable(feature = "rust1", since = "1.0.0")]
+#[derive(Clone, Debug)]
 pub struct Cursor<T> {
     inner: T,
     pos: u64,
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 237435d6dfb..39c718c96b3 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -558,6 +558,12 @@ pub trait BufRead: Read {
     /// This function does not perform any I/O, it simply informs this object
     /// that some amount of its buffer, returned from `fill_buf`, has been
     /// consumed and should no longer be returned.
+    ///
+    /// This function is used to tell the buffer how many bytes you've consumed
+    /// from the return value of `fill_buf`, and so may do odd things if
+    /// `fill_buf` isn't called before calling this.
+    ///
+    /// The `amt` must be `<=` the number of bytes in the buffer returned by `fill_buf`.
     #[stable(feature = "rust1", since = "1.0.0")]
     fn consume(&mut self, amt: usize);
 
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index b055796ba54..90eca6168f2 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -40,11 +40,11 @@
 //!
 //! ## Vectors, slices and strings
 //!
-//! The common container type, `Vec`, a growable vector backed by an
-//! array, lives in the [`vec`](vec/index.html) module. References to
-//! arrays, `&[T]`, more commonly called "slices", are built-in types
-//! for which the [`slice`](slice/index.html) module defines many
-//! methods.
+//! The common container type, `Vec`, a growable vector backed by an array,
+//! lives in the [`vec`](vec/index.html) module. Contiguous, unsized regions
+//! of memory, `[T]`, commonly called "slices", and their borrowed versions,
+//! `&[T]`, commonly called "borrowed slices", are built-in types for which the
+//! for which the [`slice`](slice/index.html) module defines many methods.
 //!
 //! `&str`, a UTF-8 string, is a built-in type, and the standard library
 //! defines methods for it on a variety of traits in the
@@ -75,7 +75,7 @@
 //!
 //! The [`thread`](thread/index.html) module contains Rust's threading abstractions.
 //! [`sync`](sync/index.html) contains further, primitive, shared memory types,
-//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpmc/index.html),
+//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpsc/index.html),
 //! which contains the channel types for message passing.
 //!
 //! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets,
@@ -105,12 +105,12 @@
        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
        html_root_url = "http://doc.rust-lang.org/nightly/",
        html_playground_url = "http://play.rust-lang.org/")]
+#![doc(test(no_crate_inject))]
 
 #![feature(alloc)]
 #![feature(box_syntax)]
 #![feature(collections)]
 #![feature(core)]
-#![feature(hash)]
 #![feature(lang_items)]
 #![feature(libc)]
 #![feature(linkage, thread_local, asm)]
@@ -123,12 +123,13 @@
 #![feature(unsafe_destructor)]
 #![feature(unsafe_no_drop_flag)]
 #![feature(macro_reexport)]
-#![feature(hash)]
 #![feature(int_uint)]
 #![feature(unique)]
+#![feature(convert)]
 #![feature(allow_internal_unstable)]
 #![feature(str_char)]
-#![cfg_attr(test, feature(test, rustc_private))]
+#![feature(into_cow)]
+#![cfg_attr(test, feature(test, rustc_private, std_misc))]
 
 // Don't link to std. We are std.
 #![feature(no_std)]
@@ -169,6 +170,7 @@ pub use core::any;
 pub use core::cell;
 pub use core::clone;
 #[cfg(not(test))] pub use core::cmp;
+pub use core::convert;
 pub use core::default;
 #[allow(deprecated)]
 pub use core::finally;
@@ -212,6 +214,9 @@ pub mod prelude;
 
 /* Primitive types */
 
+// NB: slice and str are primitive types too, but their module docs + primitive doc pages
+// are inlined from the public re-exports of core_collections::{slice, str} above.
+
 #[path = "num/float_macros.rs"]
 #[macro_use]
 mod float_macros;
@@ -249,30 +254,23 @@ pub mod num;
 /* Runtime and platform support */
 
 #[macro_use]
-pub mod thread_local;
+pub mod thread;
 
+pub mod collections;
 pub mod dynamic_lib;
+pub mod env;
 pub mod ffi;
-pub mod old_io;
-pub mod io;
 pub mod fs;
+pub mod io;
 pub mod net;
+pub mod old_io;
+pub mod old_path;
 pub mod os;
-pub mod env;
 pub mod path;
-pub mod old_path;
 pub mod process;
 pub mod rand;
-pub mod time;
-
-/* Common data structures */
-
-pub mod collections;
-
-/* Threads and communication */
-
-pub mod thread;
 pub mod sync;
+pub mod time;
 
 #[macro_use]
 #[path = "sys/common/mod.rs"] mod sys_common;
@@ -285,8 +283,9 @@ pub mod sync;
 pub mod rt;
 mod panicking;
 
-// Documentation for primitive types
+// Modules that exist purely to document + host impl docs for primitive types
 
+mod array;
 mod bool;
 mod unit;
 mod tuple;
@@ -305,7 +304,7 @@ mod std {
     pub use rt; // used for panic!()
     pub use vec; // used for vec![]
     pub use cell; // used for tls!
-    pub use thread_local; // used for thread_local!
+    pub use thread; // used for thread_local!
     pub use marker;  // used for tls!
     pub use ops; // used for bitflags!
 
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index f4a7e8b1b98..1681ed4282f 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -90,8 +90,7 @@ macro_rules! println {
 }
 
 /// Helper macro for unwrapping `Result` values while returning early with an
-/// error if the value of the expression is `Err`. For more information, see
-/// `std::io`.
+/// error if the value of the expression is `Err`.
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 macro_rules! try {
@@ -112,6 +111,7 @@ macro_rules! try {
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::thread;
 /// use std::sync::mpsc;
 ///
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs
index 87241117043..e8187dc2c40 100644
--- a/src/libstd/net/addr.rs
+++ b/src/libstd/net/addr.rs
@@ -263,6 +263,7 @@ impl hash::Hash for SocketAddrV6 {
 /// Some examples:
 ///
 /// ```no_run
+/// # #![feature(net)]
 /// use std::net::{SocketAddrV4, TcpStream, UdpSocket, TcpListener, Ipv4Addr};
 ///
 /// fn main() {
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index 73c2464a6b2..d737ad17ff8 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -374,7 +374,6 @@ impl fmt::Display for Ipv6Addr {
                             .iter()
                             .map(|&seg| format!("{:x}", seg))
                             .collect::<Vec<String>>()
-                            .as_slice()
                             .connect(":")
                     }
 
diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs
index 543fdd16f41..48b3247f212 100644
--- a/src/libstd/net/mod.rs
+++ b/src/libstd/net/mod.rs
@@ -91,6 +91,7 @@ impl Iterator for LookupHost {
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(net)]
 /// use std::net;
 ///
 /// # fn foo() -> std::io::Result<()> {
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index f263d7d72d3..869faa795f9 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -27,6 +27,7 @@ use sys_common::AsInner;
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(net)]
 /// use std::io::prelude::*;
 /// use std::net::TcpStream;
 ///
@@ -46,6 +47,7 @@ pub struct TcpStream(net_imp::TcpStream);
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(net)]
 /// use std::net::{TcpListener, TcpStream};
 /// use std::thread;
 ///
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index 1ace1957526..e593bbe8e48 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -27,6 +27,7 @@ use sys_common::AsInner;
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(net)]
 /// use std::net::UdpSocket;
 ///
 /// # fn foo() -> std::io::Result<()> {
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index b5513dfd035..a4f06f14d49 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -365,6 +365,7 @@ impl f32 {
     /// Returns the `NaN` value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let nan: f32 = Float::nan();
@@ -379,6 +380,7 @@ impl f32 {
     /// Returns the infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -396,6 +398,7 @@ impl f32 {
     /// Returns the negative infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -413,6 +416,7 @@ impl f32 {
     /// Returns `0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -431,6 +435,7 @@ impl f32 {
     /// Returns `-0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -449,6 +454,7 @@ impl f32 {
     /// Returns `1.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let one: f32 = Float::one();
@@ -525,6 +531,7 @@ impl f32 {
     /// Returns the smallest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -548,6 +555,7 @@ impl f32 {
     /// Returns the largest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -563,6 +571,7 @@ impl f32 {
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -580,6 +589,7 @@ impl f32 {
     /// false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -601,6 +611,7 @@ impl f32 {
     /// Returns `true` if this number is neither infinite nor `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -623,6 +634,7 @@ impl f32 {
     /// [subnormal][subnormal], or `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -650,6 +662,7 @@ impl f32 {
     /// predicate instead.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::{Float, FpCategory};
     /// use std::f32;
     ///
@@ -668,6 +681,7 @@ impl f32 {
     /// The floating point encoding is documented in the [Reference][floating-point].
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let num = 2.0f32;
@@ -770,6 +784,7 @@ impl f32 {
     /// number is `Float::nan()`.
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -795,6 +810,7 @@ impl f32 {
     /// - `Float::nan()` if the number is `Float::nan()`
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -856,6 +872,7 @@ impl f32 {
     /// a separate multiplication operation followed by an add.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let m = 10.0;
@@ -875,6 +892,7 @@ impl f32 {
     /// Take the reciprocal (inverse) of a number, `1/x`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -922,6 +940,7 @@ impl f32 {
     /// Returns NaN if `self` is a negative number.
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     ///
     /// let positive = 4.0;
@@ -940,6 +959,7 @@ impl f32 {
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let f = 4.0;
@@ -1061,6 +1081,7 @@ impl f32 {
     /// Convert radians to degrees.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -1077,6 +1098,7 @@ impl f32 {
     /// Convert degrees to radians.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -1093,6 +1115,7 @@ impl f32 {
     /// Constructs a floating point number of `x*2^exp`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// // 3*2^2 - 12 == 0
@@ -1114,6 +1137,7 @@ impl f32 {
     ///  * `0.5 <= abs(x) < 1.0`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 4.0;
@@ -1141,6 +1165,7 @@ impl f32 {
     /// `other`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 1.0f32;
@@ -1194,6 +1219,7 @@ impl f32 {
     /// * Else: `self - other`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 3.0;
@@ -1214,6 +1240,7 @@ impl f32 {
     /// Take the cubic root of a number.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 8.0;
@@ -1233,6 +1260,7 @@ impl f32 {
     /// legs of length `x` and `y`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -1253,6 +1281,7 @@ impl f32 {
     /// Computes the sine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1271,6 +1300,7 @@ impl f32 {
     /// Computes the cosine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1289,6 +1319,7 @@ impl f32 {
     /// Computes the tangent of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1308,6 +1339,7 @@ impl f32 {
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1329,6 +1361,7 @@ impl f32 {
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1372,6 +1405,7 @@ impl f32 {
     /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1401,6 +1435,7 @@ impl f32 {
     /// `(sin(x), cos(x))`.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1423,6 +1458,7 @@ impl f32 {
     /// number is close to zero.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 7.0;
@@ -1442,6 +1478,7 @@ impl f32 {
     /// the operations were performed separately.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1461,6 +1498,7 @@ impl f32 {
     /// Hyperbolic sine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1483,6 +1521,7 @@ impl f32 {
     /// Hyperbolic cosine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1505,6 +1544,7 @@ impl f32 {
     /// Hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1527,6 +1567,7 @@ impl f32 {
     /// Inverse hyperbolic sine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     ///
     /// let x = 1.0;
@@ -1548,6 +1589,7 @@ impl f32 {
     /// Inverse hyperbolic cosine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     ///
     /// let x = 1.0;
@@ -1569,6 +1611,7 @@ impl f32 {
     /// Inverse hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 61bddc3d18f..9306804d1f7 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -374,6 +374,7 @@ impl f64 {
     /// Returns the `NaN` value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let nan: f32 = Float::nan();
@@ -388,6 +389,7 @@ impl f64 {
     /// Returns the infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -405,6 +407,7 @@ impl f64 {
     /// Returns the negative infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -422,6 +425,7 @@ impl f64 {
     /// Returns `0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -440,6 +444,7 @@ impl f64 {
     /// Returns `-0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -458,6 +463,7 @@ impl f64 {
     /// Returns `1.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let one: f32 = Float::one();
@@ -534,6 +540,7 @@ impl f64 {
     /// Returns the smallest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -557,6 +564,7 @@ impl f64 {
     /// Returns the largest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -572,6 +580,7 @@ impl f64 {
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -589,6 +598,7 @@ impl f64 {
     /// false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -610,6 +620,7 @@ impl f64 {
     /// Returns `true` if this number is neither infinite nor `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -632,6 +643,7 @@ impl f64 {
     /// [subnormal][subnormal], or `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -659,6 +671,7 @@ impl f64 {
     /// predicate instead.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::{Float, FpCategory};
     /// use std::f32;
     ///
@@ -677,6 +690,7 @@ impl f64 {
     /// The floating point encoding is documented in the [Reference][floating-point].
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let num = 2.0f32;
@@ -779,6 +793,7 @@ impl f64 {
     /// number is `Float::nan()`.
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -804,6 +819,7 @@ impl f64 {
     /// - `Float::nan()` if the number is `Float::nan()`
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -865,6 +881,7 @@ impl f64 {
     /// a separate multiplication operation followed by an add.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let m = 10.0;
@@ -884,6 +901,7 @@ impl f64 {
     /// Take the reciprocal (inverse) of a number, `1/x`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -931,6 +949,7 @@ impl f64 {
     /// Returns NaN if `self` is a negative number.
     ///
     /// ```
+    /// # #![feature(core, std_misc)]
     /// use std::num::Float;
     ///
     /// let positive = 4.0;
@@ -948,6 +967,7 @@ impl f64 {
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let f = 4.0;
@@ -1069,6 +1089,7 @@ impl f64 {
     /// Convert radians to degrees.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -1085,6 +1106,7 @@ impl f64 {
     /// Convert degrees to radians.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -1101,6 +1123,7 @@ impl f64 {
     /// Constructs a floating point number of `x*2^exp`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// // 3*2^2 - 12 == 0
@@ -1122,6 +1145,7 @@ impl f64 {
     ///  * `0.5 <= abs(x) < 1.0`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 4.0;
@@ -1149,6 +1173,7 @@ impl f64 {
     /// `other`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 1.0f32;
@@ -1202,6 +1227,7 @@ impl f64 {
     /// * Else: `self - other`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 3.0;
@@ -1222,6 +1248,7 @@ impl f64 {
     /// Take the cubic root of a number.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 8.0;
@@ -1241,6 +1268,7 @@ impl f64 {
     /// legs of length `x` and `y`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -1261,6 +1289,7 @@ impl f64 {
     /// Computes the sine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1279,6 +1308,7 @@ impl f64 {
     /// Computes the cosine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1297,6 +1327,7 @@ impl f64 {
     /// Computes the tangent of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1316,6 +1347,7 @@ impl f64 {
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1337,6 +1369,7 @@ impl f64 {
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1380,6 +1413,7 @@ impl f64 {
     /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1409,6 +1443,7 @@ impl f64 {
     /// `(sin(x), cos(x))`.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1431,6 +1466,7 @@ impl f64 {
     /// number is close to zero.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 7.0;
@@ -1450,6 +1486,7 @@ impl f64 {
     /// the operations were performed separately.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1469,6 +1506,7 @@ impl f64 {
     /// Hyperbolic sine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1491,6 +1529,7 @@ impl f64 {
     /// Hyperbolic cosine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1513,6 +1552,7 @@ impl f64 {
     /// Hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1577,6 +1617,7 @@ impl f64 {
     /// Inverse hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 562094a87f4..b9e9433e3ee 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -55,6 +55,7 @@ pub trait Float
     /// Returns the `NaN` value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let nan: f32 = Float::nan();
@@ -67,6 +68,7 @@ pub trait Float
     /// Returns the infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -82,6 +84,7 @@ pub trait Float
     /// Returns the negative infinite value.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -97,6 +100,7 @@ pub trait Float
     /// Returns `0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -113,6 +117,7 @@ pub trait Float
     /// Returns `-0.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let inf: f32 = Float::infinity();
@@ -129,6 +134,7 @@ pub trait Float
     /// Returns `1.0`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let one: f32 = Float::one();
@@ -182,6 +188,7 @@ pub trait Float
     /// Returns the smallest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -199,6 +206,7 @@ pub trait Float
     /// Returns the largest finite value that this type can represent.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -211,6 +219,7 @@ pub trait Float
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -226,6 +235,7 @@ pub trait Float
     /// false otherwise.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -245,6 +255,7 @@ pub trait Float
     /// Returns `true` if this number is neither infinite nor `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -265,6 +276,7 @@ pub trait Float
     /// [subnormal][subnormal], or `NaN`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f32;
     ///
@@ -291,6 +303,7 @@ pub trait Float
     /// predicate instead.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::{Float, FpCategory};
     /// use std::f32;
     ///
@@ -308,6 +321,7 @@ pub trait Float
     /// The floating point encoding is documented in the [Reference][floating-point].
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let num = 2.0f32;
@@ -399,6 +413,7 @@ pub trait Float
     /// number is `Float::nan()`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -422,6 +437,7 @@ pub trait Float
     /// - `Float::nan()` if the number is `Float::nan()`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -478,6 +494,7 @@ pub trait Float
     /// a separate multiplication operation followed by an add.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let m = 10.0;
@@ -495,6 +512,7 @@ pub trait Float
     /// Take the reciprocal (inverse) of a number, `1/x`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -537,6 +555,7 @@ pub trait Float
     /// Returns NaN if `self` is a negative number.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let positive = 4.0;
@@ -553,6 +572,7 @@ pub trait Float
     /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let f = 4.0;
@@ -662,6 +682,7 @@ pub trait Float
     /// Convert radians to degrees.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -676,6 +697,7 @@ pub trait Float
     /// Convert degrees to radians.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64::consts;
     ///
@@ -690,6 +712,7 @@ pub trait Float
     /// Constructs a floating point number of `x*2^exp`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// // 3*2^2 - 12 == 0
@@ -707,6 +730,7 @@ pub trait Float
     ///  * `0.5 <= abs(x) < 1.0`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 4.0;
@@ -726,6 +750,7 @@ pub trait Float
     /// `other`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 1.0f32;
@@ -769,6 +794,7 @@ pub trait Float
     /// * Else: `self - other`
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 3.0;
@@ -785,6 +811,7 @@ pub trait Float
     /// Take the cubic root of a number.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 8.0;
@@ -800,6 +827,7 @@ pub trait Float
     /// legs of length `x` and `y`.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 2.0;
@@ -817,6 +845,7 @@ pub trait Float
     /// Computes the sine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -831,6 +860,7 @@ pub trait Float
     /// Computes the cosine of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -845,6 +875,7 @@ pub trait Float
     /// Computes the tangent of a number (in radians).
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -860,6 +891,7 @@ pub trait Float
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -877,6 +909,7 @@ pub trait Float
     /// [-1, 1].
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -912,6 +945,7 @@ pub trait Float
     /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -937,6 +971,7 @@ pub trait Float
     /// `(sin(x), cos(x))`.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -956,6 +991,7 @@ pub trait Float
     /// number is close to zero.
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::num::Float;
     ///
     /// let x = 7.0;
@@ -971,6 +1007,7 @@ pub trait Float
     /// the operations were performed separately.
     ///
     /// ```
+    /// # #![feature(std_misc, core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -987,6 +1024,7 @@ pub trait Float
     /// Hyperbolic sine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1005,6 +1043,7 @@ pub trait Float
     /// Hyperbolic cosine function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1023,6 +1062,7 @@ pub trait Float
     /// Hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
@@ -1069,6 +1109,7 @@ pub trait Float
     /// Inverse hyperbolic tangent function.
     ///
     /// ```
+    /// # #![feature(core)]
     /// use std::num::Float;
     /// use std::f64;
     ///
diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs
index 3e5f732e345..cb67d709a14 100644
--- a/src/libstd/old_io/buffered.rs
+++ b/src/libstd/old_io/buffered.rs
@@ -33,6 +33,7 @@ use vec::Vec;
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
 ///
@@ -137,6 +138,7 @@ impl<R: Reader> Reader for BufferedReader<R> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
 ///
@@ -324,6 +326,7 @@ impl<W: Reader> Reader for InternalBufferedWriter<W> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs
index 7e62a21f105..cd8252540da 100644
--- a/src/libstd/old_io/comm_adapters.rs
+++ b/src/libstd/old_io/comm_adapters.rs
@@ -23,6 +23,7 @@ use vec::Vec;
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// use std::sync::mpsc::channel;
 /// use std::old_io::*;
 ///
@@ -114,6 +115,7 @@ impl Reader for ChanReader {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, io)]
 /// # #![allow(unused_must_use)]
 /// use std::sync::mpsc::channel;
 /// use std::old_io::*;
diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs
index 2990c1c265d..5b1b9471b07 100644
--- a/src/libstd/old_io/extensions.rs
+++ b/src/libstd/old_io/extensions.rs
@@ -159,7 +159,7 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where
 ///           that many bytes are parsed. For example, if `size` is 4, then a
 ///           32-bit value is parsed.
 pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
-    use ptr::{copy_nonoverlapping_memory};
+    use ptr::{copy_nonoverlapping};
 
     assert!(size <= 8);
 
@@ -171,7 +171,7 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 {
     unsafe {
         let ptr = data.as_ptr().offset(start as int);
         let out = buf.as_mut_ptr();
-        copy_nonoverlapping_memory(out.offset((8 - size) as int), ptr, size);
+        copy_nonoverlapping(out.offset((8 - size) as int), ptr, size);
         (*(out as *const u64)).to_be()
     }
 }
diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs
index 87e5b91fc28..40a7cce81dd 100644
--- a/src/libstd/old_io/fs.rs
+++ b/src/libstd/old_io/fs.rs
@@ -30,6 +30,7 @@
 //! # Examples
 //!
 //! ```rust
+//! # #![feature(old_io, io, old_path)]
 //! # #![allow(unused_must_use)]
 //! use std::old_io::fs::PathExtensions;
 //! use std::old_io::*;
@@ -105,6 +106,7 @@ impl File {
     /// # Examples
     ///
     /// ```rust,should_fail
+    /// # #![feature(old_io, old_path)]
     /// use std::old_io::*;
     /// use std::old_path::Path;
     ///
@@ -177,6 +179,7 @@ impl File {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, old_path)]
     /// use std::old_io::*;
     /// use std::old_path::Path;
     ///
@@ -197,6 +200,7 @@ impl File {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, old_path, io)]
     /// # #![allow(unused_must_use)]
     /// use std::old_io::*;
     /// use std::old_path::Path;
@@ -289,6 +293,7 @@ impl File {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
@@ -321,6 +326,7 @@ pub fn unlink(path: &Path) -> IoResult<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
 ///
@@ -364,6 +370,7 @@ pub fn lstat(path: &Path) -> IoResult<FileStat> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
@@ -393,6 +400,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
@@ -444,6 +452,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io;
 /// use std::old_io::*;
@@ -516,6 +525,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path, old_fs)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io;
 /// use std::old_io::*;
@@ -541,6 +551,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 /// use std::old_path::Path;
@@ -566,6 +577,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, old_path)]
 /// use std::old_io::fs::PathExtensions;
 /// use std::old_io;
 /// use std::old_io::*;
diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs
index 1acc6abc850..d877a60b079 100644
--- a/src/libstd/old_io/mem.rs
+++ b/src/libstd/old_io/mem.rs
@@ -54,6 +54,7 @@ impl Writer for Vec<u8> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, io)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 ///
@@ -114,6 +115,7 @@ impl Writer for MemWriter {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 ///
@@ -244,6 +246,7 @@ impl<'a> Buffer for &'a [u8] {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, io)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 ///
@@ -316,6 +319,7 @@ impl<'a> Seek for BufWriter<'a> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// # #![allow(unused_must_use)]
 /// use std::old_io::*;
 ///
diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs
index 6dfb54fd66c..ac908c529dc 100644
--- a/src/libstd/old_io/mod.rs
+++ b/src/libstd/old_io/mod.rs
@@ -48,6 +48,7 @@
 //! * Read lines from stdin
 //!
 //!     ```rust
+//!     # #![feature(old_io, old_path)]
 //!     use std::old_io as io;
 //!     use std::old_io::*;
 //!
@@ -60,6 +61,7 @@
 //! * Read a complete file
 //!
 //!     ```rust
+//!     # #![feature(old_io, old_path)]
 //!     use std::old_io::*;
 //!     use std::old_path::Path;
 //!
@@ -69,6 +71,7 @@
 //! * Write a line to a file
 //!
 //!     ```rust
+//!     # #![feature(old_io, old_path)]
 //!     # #![allow(unused_must_use)]
 //!     use std::old_io::*;
 //!     use std::old_path::Path;
@@ -82,6 +85,7 @@
 //! * Iterate over the lines of a file
 //!
 //!     ```rust,no_run
+//!     # #![feature(old_io, old_path)]
 //!     use std::old_io::*;
 //!     use std::old_path::Path;
 //!
@@ -95,6 +99,7 @@
 //! * Pull the lines of a file into a vector of strings
 //!
 //!     ```rust,no_run
+//!     # #![feature(old_io, old_path)]
 //!     use std::old_io::*;
 //!     use std::old_path::Path;
 //!
@@ -106,6 +111,7 @@
 //! * Make a simple TCP client connection and request
 //!
 //!     ```rust
+//!     # #![feature(old_io)]
 //!     # #![allow(unused_must_use)]
 //!     use std::old_io::*;
 //!
@@ -122,6 +128,7 @@
 //! * Make a simple TCP server
 //!
 //!     ```rust
+//!     # #![feature(old_io)]
 //!     # fn main() { }
 //!     # fn foo() {
 //!     # #![allow(dead_code)]
@@ -186,6 +193,7 @@
 //! If you wanted to handle the error though you might write:
 //!
 //! ```rust
+//! # #![feature(old_io, old_path)]
 //! # #![allow(unused_must_use)]
 //! use std::old_io::*;
 //! use std::old_path::Path;
@@ -221,6 +229,7 @@
 //! If you wanted to read several `u32`s from a file and return their product:
 //!
 //! ```rust
+//! # #![feature(old_io, old_path)]
 //! use std::old_io::*;
 //! use std::old_path::Path;
 //!
@@ -948,6 +957,7 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// use std::old_io as io;
 /// use std::old_io::*;
 /// use std::old_io::util::LimitReader;
@@ -1282,6 +1292,7 @@ impl<'a> Writer for &'a mut (Writer+'a) {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// use std::old_io::util::TeeReader;
 /// use std::old_io::*;
 ///
@@ -1407,6 +1418,7 @@ pub trait Buffer: Reader {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io)]
     /// use std::old_io::*;
     ///
     /// let mut reader = BufReader::new(b"hello\nworld");
@@ -1631,6 +1643,7 @@ impl<'a, T, A: ?Sized + Acceptor<T>> Iterator for IncomingConnections<'a, A> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// use std::old_io as io;
 ///
 /// let eof = io::standard_error(io::EndOfFile);
@@ -1719,6 +1732,7 @@ pub enum FileType {
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(old_io, old_path)]
 ///
 /// use std::old_io::fs::PathExtensions;
 /// use std::old_path::Path;
diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs
index 077a5072570..f7953ac51b8 100644
--- a/src/libstd/old_io/net/ip.rs
+++ b/src/libstd/old_io/net/ip.rs
@@ -414,6 +414,7 @@ pub struct ParseError;
 /// Some examples:
 ///
 /// ```rust,no_run
+/// # #![feature(old_io, core)]
 /// # #![allow(unused_must_use)]
 ///
 /// use std::old_io::{TcpStream, TcpListener};
diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs
index 77efedbc327..f9e5ae71e12 100644
--- a/src/libstd/old_io/net/pipe.rs
+++ b/src/libstd/old_io/net/pipe.rs
@@ -54,6 +54,7 @@ impl UnixStream {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, old_path, io)]
     /// # #![allow(unused_must_use)]
     /// use std::old_io::net::pipe::UnixStream;
     /// use std::old_io::*;
@@ -181,6 +182,7 @@ impl UnixListener {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, io, old_path)]
     /// # fn foo() {
     /// use std::old_io::net::pipe::UnixListener;
     /// use std::old_io::*;
diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs
index dbf3c4a4b1e..75f786f0bb1 100644
--- a/src/libstd/old_io/net/tcp.rs
+++ b/src/libstd/old_io/net/tcp.rs
@@ -41,6 +41,7 @@ use sys_common;
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(old_io, io)]
 /// use std::old_io::*;
 ///
 /// {
@@ -133,6 +134,7 @@ impl TcpStream {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(old_io, std_misc)]
     /// # #![allow(unused_must_use)]
     /// use std::old_io::*;
     /// use std::time::Duration;
@@ -278,6 +280,7 @@ impl sys_common::AsInner<TcpStreamImp> for TcpStream {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io)]
 /// # fn foo() {
 /// use std::old_io::*;
 /// use std::thread;
@@ -374,6 +377,7 @@ impl TcpAcceptor {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(old_io, io)]
     /// use std::old_io::*;
     ///
     /// let mut a = TcpListener::bind("127.0.0.1:8482").listen().unwrap();
@@ -417,6 +421,7 @@ impl TcpAcceptor {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, io)]
     /// use std::old_io::*;
     /// use std::thread;
     ///
diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs
index 97ef3da2f36..3aa811974b3 100644
--- a/src/libstd/old_io/net/udp.rs
+++ b/src/libstd/old_io/net/udp.rs
@@ -31,6 +31,7 @@ use sys_common;
 /// # Examples
 ///
 /// ```rust,no_run
+/// # #![feature(old_io)]
 /// # #![allow(unused_must_use)]
 ///
 /// use std::old_io::net::udp::UdpSocket;
diff --git a/src/libstd/old_io/pipe.rs b/src/libstd/old_io/pipe.rs
index b2b28453c89..0b555e2f0ff 100644
--- a/src/libstd/old_io/pipe.rs
+++ b/src/libstd/old_io/pipe.rs
@@ -46,6 +46,7 @@ impl PipeStream {
     /// # Examples
     ///
     /// ```{rust,no_run}
+    /// # #![feature(old_io, libc, io)]
     /// # #![allow(unused_must_use)]
     /// extern crate libc;
     ///
diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs
index 54fd20f45e2..d7ede451fb8 100644
--- a/src/libstd/old_io/process.rs
+++ b/src/libstd/old_io/process.rs
@@ -61,6 +61,7 @@ use thread;
 /// # Examples
 ///
 /// ```should_fail
+/// # #![feature(old_io)]
 /// use std::old_io::*;
 ///
 /// let mut child = match Command::new("/bin/cat").arg("file.txt").spawn() {
@@ -164,6 +165,7 @@ pub type EnvMap = HashMap<EnvKey, CString>;
 /// to be changed (for example, by adding arguments) prior to spawning:
 ///
 /// ```
+/// # #![feature(old_io)]
 /// use std::old_io::*;
 ///
 /// let mut process = match Command::new("sh").arg("-c").arg("echo hello").spawn() {
@@ -365,6 +367,7 @@ impl Command {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, core)]
     /// use std::old_io::Command;
     ///
     /// let output = match Command::new("cat").arg("foot.txt").output() {
@@ -386,6 +389,7 @@ impl Command {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io)]
     /// use std::old_io::Command;
     ///
     /// let status = match Command::new("ls").status() {
@@ -660,6 +664,7 @@ impl Process {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(old_io, io)]
     /// use std::old_io::{Command, IoResult};
     /// use std::old_io::process::ProcessExit;
     ///
diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs
index a1c8630e0ec..ef811f832b3 100644
--- a/src/libstd/old_io/stdio.rs
+++ b/src/libstd/old_io/stdio.rs
@@ -18,6 +18,7 @@
 //! # Examples
 //!
 //! ```rust
+//! # #![feature(old_io)]
 //! # #![allow(unused_must_use)]
 //! use std::old_io;
 //! use std::old_io::*;
@@ -140,6 +141,7 @@ impl StdinReader {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io)]
     /// use std::old_io;
     /// use std::old_io::*;
     ///
diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs
index 90b3d1004c0..c0f6ddaaef7 100644
--- a/src/libstd/old_io/tempfile.rs
+++ b/src/libstd/old_io/tempfile.rs
@@ -29,6 +29,7 @@ use string::String;
 /// # Examples
 ///
 /// ```no_run
+/// # #![feature(old_io, old_path)]
 /// use std::old_io::*;
 /// use std::old_path::{Path, GenericPath};
 ///
diff --git a/src/libstd/old_io/timer.rs b/src/libstd/old_io/timer.rs
index 65c62a99335..f8cba044443 100644
--- a/src/libstd/old_io/timer.rs
+++ b/src/libstd/old_io/timer.rs
@@ -31,6 +31,7 @@ use sys::timer::Timer as TimerImp;
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_io, std_misc)]
 /// # fn foo() {
 /// use std::old_io::Timer;
 /// use std::time::Duration;
@@ -54,6 +55,7 @@ use sys::timer::Timer as TimerImp;
 /// the `old_io::timer` module.
 ///
 /// ```
+/// # #![feature(old_io, std_misc)]
 /// # fn foo() {
 /// use std::old_io::timer;
 /// use std::time::Duration;
@@ -116,6 +118,7 @@ impl Timer {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, std_misc)]
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -129,6 +132,7 @@ impl Timer {
     /// ```
     ///
     /// ```
+    /// # #![feature(old_io, std_misc)]
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -168,6 +172,7 @@ impl Timer {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_io, std_misc)]
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
@@ -187,6 +192,7 @@ impl Timer {
     /// ```
     ///
     /// ```
+    /// # #![feature(old_io, std_misc)]
     /// use std::old_io::Timer;
     /// use std::time::Duration;
     ///
diff --git a/src/libstd/old_path/mod.rs b/src/libstd/old_path/mod.rs
index 909fa4062b6..50bda04b5d0 100644
--- a/src/libstd/old_path/mod.rs
+++ b/src/libstd/old_path/mod.rs
@@ -49,6 +49,7 @@
 //! ## Examples
 //!
 //! ```rust
+//! # #![feature(old_path, old_io)]
 //! use std::old_io::fs::PathExtensions;
 //! use std::old_path::{Path, GenericPath};
 //!
@@ -143,6 +144,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -168,6 +170,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -191,6 +194,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -209,6 +213,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -224,6 +229,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -240,6 +246,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -259,6 +266,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -277,6 +285,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -293,6 +302,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -313,6 +323,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -329,6 +340,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -349,6 +361,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -377,6 +390,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -398,6 +412,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -426,6 +441,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -445,6 +461,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -472,6 +489,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -523,6 +541,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -549,6 +568,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -574,6 +594,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -594,6 +615,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -610,6 +632,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -635,6 +658,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -665,6 +689,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -683,6 +708,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -709,6 +735,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -732,6 +759,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -750,6 +778,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -769,6 +798,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -789,6 +819,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
@@ -806,6 +837,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// # foo();
     /// # #[cfg(windows)] fn foo() {}
diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs
index cea2c238ece..4f367e30526 100644
--- a/src/libstd/old_path/windows.rs
+++ b/src/libstd/old_path/windows.rs
@@ -605,6 +605,7 @@ impl Path {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// println!("{}", Path::new(r"C:\some\path").display());
     /// ```
@@ -620,6 +621,7 @@ impl Path {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(old_path)]
     /// use std::old_path::{Path, GenericPath};
     /// let path = Path::new_opt(r"C:\some\path");
     ///
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 3870b8614ff..40aaea7aca0 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -38,6 +38,7 @@ use self::MapError::*;
 
 use boxed::Box;
 use clone::Clone;
+use convert::From;
 use env;
 use error::{FromError, Error};
 use ffi::{OsString, OsStr};
@@ -79,12 +80,12 @@ fn err2old(new: ::io::Error) -> IoError {
 
 #[cfg(windows)]
 fn path2new(path: &Path) -> PathBuf {
-    PathBuf::new(path.as_str().unwrap())
+    PathBuf::from(path.as_str().unwrap())
 }
 #[cfg(unix)]
 fn path2new(path: &Path) -> PathBuf {
     use os::unix::prelude::*;
-    PathBuf::new(<OsStr as OsStrExt>::from_bytes(path.as_vec()))
+    PathBuf::from(<OsStr as OsStrExt>::from_bytes(path.as_vec()))
 }
 
 #[cfg(unix)]
@@ -125,6 +126,7 @@ pub const TMPBUF_SZ : uint = 1000;
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -146,6 +148,7 @@ pub fn getcwd() -> IoResult<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os)]
 /// use std::os;
 ///
 /// // We will iterate through the references to the element returned by os::env();
@@ -182,6 +185,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>, Vec<u8>)> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os)]
 /// use std::os;
 ///
 /// let key = "HOME";
@@ -224,6 +228,7 @@ fn byteify(s: OsString) -> Vec<u8> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os)]
 /// use std::os;
 ///
 /// let key = "KEY";
@@ -265,6 +270,7 @@ pub fn unsetenv(n: &str) {
 /// # Examples
 ///
 /// ```
+/// # #![feature(old_path, os)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -298,6 +304,7 @@ pub fn split_paths<T: BytesContainer>(unparsed: T) -> Vec<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path, core)]
 /// use std::os;
 /// use std::old_path::Path;
 ///
@@ -359,6 +366,7 @@ pub fn dll_filename(base: &str) -> String {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -380,6 +388,7 @@ pub fn self_exe_name() -> Option<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -410,6 +419,7 @@ pub fn self_exe_path() -> Option<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -501,6 +511,7 @@ pub fn tmpdir() -> Path {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -533,6 +544,7 @@ pub fn make_absolute(p: &Path) -> IoResult<Path> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os, old_path)]
 /// use std::os;
 /// use std::old_path::{Path, GenericPath};
 ///
@@ -555,6 +567,7 @@ pub fn errno() -> i32 {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os)]
 /// use std::os;
 ///
 /// // Same as println!("{}", last_os_error());
@@ -751,6 +764,7 @@ extern "system" {
 /// # Examples
 ///
 /// ```
+/// # #![feature(os)]
 /// use std::os;
 ///
 /// // Prints each argument on a separate line
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index ddceed14cc6..50f79967f55 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -35,9 +35,10 @@
 //! To build or modify paths, use `PathBuf`:
 //!
 //! ```rust
+//! # #![feature(convert)]
 //! use std::path::PathBuf;
 //!
-//! let mut path = PathBuf::new("c:\\");
+//! let mut path = PathBuf::from("c:\\");
 //! path.push("windows");
 //! path.push("system32");
 //! path.set_extension("dll");
@@ -106,6 +107,7 @@ use cmp;
 use iter::{self, IntoIterator};
 use mem;
 use ops::{self, Deref};
+use string::String;
 use vec::Vec;
 use fmt;
 
@@ -527,6 +529,13 @@ impl<'a> Component<'a> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> AsRef<OsStr> for Component<'a> {
+    fn as_ref(&self) -> &OsStr {
+        self.as_os_str()
+    }
+}
+
 /// The core iterator giving the components of a path.
 ///
 /// See the module documentation for an in-depth explanation of components and
@@ -601,6 +610,7 @@ impl<'a> Components<'a> {
     }
 
     /// Extract a slice corresponding to the portion of the path remaining for iteration.
+    #[stable(feature = "rust1", since = "1.0.0")]
     pub fn as_path(&self) -> &'a Path {
         let mut comps = self.clone();
         if comps.front == State::Body { comps.trim_left(); }
@@ -695,6 +705,20 @@ impl<'a> Components<'a> {
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> AsRef<Path> for Components<'a> {
+    fn as_ref(&self) -> &Path {
+        self.as_path()
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> AsRef<OsStr> for Components<'a> {
+    fn as_ref(&self) -> &OsStr {
+        self.as_path().as_os_str()
+    }
+}
+
 impl<'a> Iter<'a> {
     /// Extract a slice corresponding to the portion of the path remaining for iteration.
     #[stable(feature = "rust1", since = "1.0.0")]
@@ -704,6 +728,20 @@ impl<'a> Iter<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> AsRef<Path> for Iter<'a> {
+    fn as_ref(&self) -> &Path {
+        self.as_path()
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> AsRef<OsStr> for Iter<'a> {
+    fn as_ref(&self) -> &OsStr {
+        self.as_path().as_os_str()
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for Iter<'a> {
     type Item = &'a OsStr;
 
@@ -855,9 +893,10 @@ impl<'a> cmp::Ord for Components<'a> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(convert)]
 /// use std::path::PathBuf;
 ///
-/// let mut path = PathBuf::new("c:\\");
+/// let mut path = PathBuf::from("c:\\");
 /// path.push("windows");
 /// path.push("system32");
 /// path.set_extension("dll");
@@ -873,11 +912,10 @@ impl PathBuf {
         unsafe { mem::transmute(self) }
     }
 
-    /// Allocate a `PathBuf` with initial contents given by the
-    /// argument.
+    /// Allocate an empty `PathBuf`.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn new<S: AsOsStr>(s: S) -> PathBuf {
-        PathBuf { inner: s.as_os_str().to_os_string() }
+    pub fn new() -> PathBuf {
+        PathBuf { inner: OsString::new() }
     }
 
     /// Extend `self` with `path`.
@@ -890,8 +928,8 @@ impl PathBuf {
     ///   replaces everything except for the prefix (if any) of `self`.
     /// * if `path` has a prefix but no root, it replaces `self.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn push<P: AsPath>(&mut self, path: P) {
-        let path = path.as_path();
+    pub fn push<P: AsRef<Path>>(&mut self, path: P) {
+        let path = path.as_ref();
 
         // in general, a separator is needed if the rightmost byte is not a separator
         let mut need_sep = self.as_mut_vec().last().map(|c| !is_sep_byte(*c)).unwrap_or(false);
@@ -947,23 +985,24 @@ impl PathBuf {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(convert)]
     /// use std::path::PathBuf;
     ///
-    /// let mut buf = PathBuf::new("/");
+    /// let mut buf = PathBuf::from("/");
     /// assert!(buf.file_name() == None);
     /// buf.set_file_name("bar");
-    /// assert!(buf == PathBuf::new("/bar"));
+    /// assert!(buf == PathBuf::from("/bar"));
     /// assert!(buf.file_name().is_some());
     /// buf.set_file_name("baz.txt");
-    /// assert!(buf == PathBuf::new("/baz.txt"));
+    /// assert!(buf == PathBuf::from("/baz.txt"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn set_file_name<S: AsOsStr>(&mut self, file_name: S) {
+    pub fn set_file_name<S: AsRef<OsStr>>(&mut self, file_name: S) {
         if self.file_name().is_some() {
             let popped = self.pop();
             debug_assert!(popped);
         }
-        self.push(file_name.as_os_str());
+        self.push(file_name.as_ref());
     }
 
     /// Updates `self.extension()` to `extension`.
@@ -973,15 +1012,15 @@ impl PathBuf {
     /// Otherwise, returns `true`; if `self.extension()` is `None`, the extension
     /// is added; otherwise it is replaced.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn set_extension<S: AsOsStr>(&mut self, extension: S) -> bool {
+    pub fn set_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool {
         if self.file_name().is_none() { return false; }
 
         let mut stem = match self.file_stem() {
             Some(stem) => stem.to_os_string(),
-            None => OsString::from_str(""),
+            None => OsString::new(),
         };
 
-        let extension = extension.as_os_str();
+        let extension = extension.as_ref();
         if os_str_as_u8_slice(extension).len() > 0 {
             stem.push(".");
             stem.push(extension);
@@ -999,16 +1038,65 @@ impl PathBuf {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<P: AsPath> iter::FromIterator<P> for PathBuf {
+impl<'a> From<&'a Path> for PathBuf {
+    fn from(s: &'a Path) -> PathBuf {
+        s.to_path_buf()
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a str> for PathBuf {
+    fn from(s: &'a str) -> PathBuf {
+        PathBuf::from(OsString::from(s))
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a String> for PathBuf {
+    fn from(s: &'a String) -> PathBuf {
+        PathBuf::from(OsString::from(s))
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl From<String> for PathBuf {
+    fn from(s: String) -> PathBuf {
+        PathBuf::from(OsString::from(s))
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a OsStr> for PathBuf {
+    fn from(s: &'a OsStr) -> PathBuf {
+        PathBuf::from(OsString::from(s))
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<'a> From<&'a OsString> for PathBuf {
+    fn from(s: &'a OsString) -> PathBuf {
+        PathBuf::from(s.to_os_string())
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl From<OsString> for PathBuf {
+    fn from(s: OsString) -> PathBuf {
+        PathBuf { inner: s }
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
     fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
-        let mut buf = PathBuf::new("");
+        let mut buf = PathBuf::new();
         buf.extend(iter);
         buf
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<P: AsPath> iter::Extend<P> for PathBuf {
+impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
     fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I) {
         for p in iter {
             self.push(p)
@@ -1084,12 +1172,27 @@ impl cmp::Ord for PathBuf {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for PathBuf {
+    fn as_ref(&self) -> &OsStr {
+        &self.inner[..]
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for PathBuf {
     fn as_os_str(&self) -> &OsStr {
         &self.inner[..]
     }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl Into<OsString> for PathBuf {
+    fn into(self) -> OsString {
+        self.inner
+    }
+}
+
 /// A slice of a path (akin to `str`).
 ///
 /// This type supports a number of operations for inspecting a path, including
@@ -1133,8 +1236,14 @@ impl Path {
     ///
     /// This is a cost-free conversion.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn new<S: ?Sized + AsOsStr>(s: &S) -> &Path {
-        unsafe { mem::transmute(s.as_os_str()) }
+    pub fn new<S: AsRef<OsStr> + ?Sized>(s: &S) -> &Path {
+        unsafe { mem::transmute(s.as_ref()) }
+    }
+
+    /// Yield the underlying `OsStr` slice.
+    #[stable(feature = "rust1", since = "1.0.0")]
+    pub fn as_os_str(&self) -> &OsStr {
+        &self.inner
     }
 
     /// Yield a `&str` slice if the `Path` is valid unicode.
@@ -1156,7 +1265,7 @@ impl Path {
     /// Convert a `Path` to an owned `PathBuf`.
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_path_buf(&self) -> PathBuf {
-        PathBuf::new(self)
+        PathBuf::from(self.inner.to_os_string())
     }
 
     /// A path is *absolute* if it is independent of the current directory.
@@ -1243,23 +1352,25 @@ impl Path {
     }
 
     /// Returns a path that, when joined onto `base`, yields `self`.
+    ///
+    /// If `base` is not a prefix of `self` (i.e. `starts_with`
+    /// returns false), then `relative_from` returns `None`.
     #[unstable(feature = "path_relative_from", reason = "see #23284")]
-    pub fn relative_from<'a, P: ?Sized>(&'a self, base: &'a P) -> Option<&Path> where
-        P: AsPath
+    pub fn relative_from<'a, P: ?Sized + AsRef<Path>>(&'a self, base: &'a P) -> Option<&Path>
     {
-        iter_after(self.components(), base.as_path().components()).map(|c| c.as_path())
+        iter_after(self.components(), base.as_ref().components()).map(|c| c.as_path())
     }
 
     /// Determines whether `base` is a prefix of `self`.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn starts_with<P: AsPath>(&self, base: P) -> bool {
-        iter_after(self.components(), base.as_path().components()).is_some()
+    pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
+        iter_after(self.components(), base.as_ref().components()).is_some()
     }
 
     /// Determines whether `child` is a suffix of `self`.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn ends_with<P: AsPath>(&self, child: P) -> bool {
-        iter_after(self.components().rev(), child.as_path().components().rev()).is_some()
+    pub fn ends_with<P: AsRef<Path>>(&self, child: P) -> bool {
+        iter_after(self.components().rev(), child.as_ref().components().rev()).is_some()
     }
 
     /// Extract the stem (non-extension) portion of `self.file()`.
@@ -1292,7 +1403,7 @@ impl Path {
     ///
     /// See `PathBuf::push` for more details on what it means to adjoin a path.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn join<P: AsPath>(&self, path: P) -> PathBuf {
+    pub fn join<P: AsRef<Path>>(&self, path: P) -> PathBuf {
         let mut buf = self.to_path_buf();
         buf.push(path);
         buf
@@ -1302,7 +1413,7 @@ impl Path {
     ///
     /// See `PathBuf::set_file_name` for more details.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_file_name<S: AsOsStr>(&self, file_name: S) -> PathBuf {
+    pub fn with_file_name<S: AsRef<OsStr>>(&self, file_name: S) -> PathBuf {
         let mut buf = self.to_path_buf();
         buf.set_file_name(file_name);
         buf
@@ -1312,7 +1423,7 @@ impl Path {
     ///
     /// See `PathBuf::set_extension` for more details.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn with_extension<S: AsOsStr>(&self, extension: S) -> PathBuf {
+    pub fn with_extension<S: AsRef<OsStr>>(&self, extension: S) -> PathBuf {
         let mut buf = self.to_path_buf();
         buf.set_extension(extension);
         buf
@@ -1346,6 +1457,14 @@ impl Path {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<OsStr> for Path {
+    fn as_ref(&self) -> &OsStr {
+        &self.inner
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "trait is deprecated")]
 impl AsOsStr for Path {
     fn as_os_str(&self) -> &OsStr {
         &self.inner
@@ -1405,6 +1524,7 @@ impl cmp::Ord for Path {
 
 /// Freely convertible to a `Path`.
 #[unstable(feature = "std_misc")]
+#[deprecated(since = "1.0.0", reason = "use std::convert::AsRef<Path> instead")]
 pub trait AsPath {
     /// Convert to a `Path`.
     #[unstable(feature = "std_misc")]
@@ -1412,10 +1532,42 @@ pub trait AsPath {
 }
 
 #[unstable(feature = "std_misc")]
+#[deprecated(since = "1.0.0", reason = "use std::convert::AsRef<Path> instead")]
+#[allow(deprecated)]
 impl<T: AsOsStr + ?Sized> AsPath for T {
     fn as_path(&self) -> &Path { Path::new(self.as_os_str()) }
 }
 
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for Path {
+    fn as_ref(&self) -> &Path { self }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for OsStr {
+    fn as_ref(&self) -> &Path { Path::new(self) }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for OsString {
+    fn as_ref(&self) -> &Path { Path::new(self) }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for str {
+    fn as_ref(&self) -> &Path { Path::new(self) }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for String {
+    fn as_ref(&self) -> &Path { Path::new(self) }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl AsRef<Path> for PathBuf {
+    fn as_ref(&self) -> &Path { self }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
@@ -1512,7 +1664,7 @@ mod tests {
 
         let static_path = Path::new("/home/foo");
         let static_cow_path: Cow<'static, Path> = static_path.into_cow();
-        let pathbuf = PathBuf::new("/home/foo");
+        let pathbuf = PathBuf::from("/home/foo");
 
         {
             let path: &Path = &pathbuf;
@@ -2394,7 +2546,7 @@ mod tests {
     pub fn test_push() {
         macro_rules! tp(
             ($path:expr, $push:expr, $expected:expr) => ( {
-                let mut actual = PathBuf::new($path);
+                let mut actual = PathBuf::from($path);
                 actual.push($push);
                 assert!(actual.to_str() == Some($expected),
                         "pushing {:?} onto {:?}: Expected {:?}, got {:?}",
@@ -2482,7 +2634,7 @@ mod tests {
     pub fn test_pop() {
         macro_rules! tp(
             ($path:expr, $expected:expr, $output:expr) => ( {
-                let mut actual = PathBuf::new($path);
+                let mut actual = PathBuf::from($path);
                 let output = actual.pop();
                 assert!(actual.to_str() == Some($expected) && output == $output,
                         "popping from {:?}: Expected {:?}/{:?}, got {:?}/{:?}",
@@ -2536,7 +2688,7 @@ mod tests {
     pub fn test_set_file_name() {
         macro_rules! tfn(
                 ($path:expr, $file:expr, $expected:expr) => ( {
-                let mut p = PathBuf::new($path);
+                let mut p = PathBuf::from($path);
                 p.set_file_name($file);
                 assert!(p.to_str() == Some($expected),
                         "setting file name of {:?} to {:?}: Expected {:?}, got {:?}",
@@ -2570,7 +2722,7 @@ mod tests {
     pub fn test_set_extension() {
         macro_rules! tfe(
                 ($path:expr, $ext:expr, $expected:expr, $output:expr) => ( {
-                let mut p = PathBuf::new($path);
+                let mut p = PathBuf::from($path);
                 let output = p.set_extension($ext);
                 assert!(p.to_str() == Some($expected) && output == $output,
                         "setting extension of {:?} to {:?}: Expected {:?}/{:?}, got {:?}/{:?}",
diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs
index a0b4c80e9f3..6e12ac1a226 100644
--- a/src/libstd/prelude/v1.rs
+++ b/src/libstd/prelude/v1.rs
@@ -29,6 +29,8 @@
 #[doc(no_inline)] pub use clone::Clone;
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
+#[unstable(feature = "convert")]
+#[doc(no_inline)] pub use convert::{AsRef, AsMut, Into, From};
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use iter::DoubleEndedIterator;
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -40,8 +42,10 @@
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use result::Result::{self, Ok, Err};
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 #[doc(no_inline)] pub use slice::{SliceConcatExt, AsSlice};
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 #[doc(no_inline)] pub use str::Str;
 #[stable(feature = "rust1", since = "1.0.0")]
 #[doc(no_inline)] pub use string::{String, ToString};
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 6b09636c1df..553412c8371 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -19,8 +19,8 @@ use io::prelude::*;
 use ffi::AsOsStr;
 use fmt;
 use io::{self, Error, ErrorKind};
-use path::AsPath;
 use libc;
+use path;
 use sync::mpsc::{channel, Receiver};
 use sys::pipe2::{self, AnonPipe};
 use sys::process2::Process as ProcessImp;
@@ -198,8 +198,8 @@ impl Command {
 
     /// Set the working directory for the child process.
     #[stable(feature = "process", since = "1.0.0")]
-    pub fn current_dir<P: AsPath>(&mut self, dir: P) -> &mut Command {
-        self.inner.cwd(dir.as_path().as_os_str());
+    pub fn current_dir<P: AsRef<path::Path>>(&mut self, dir: P) -> &mut Command {
+        self.inner.cwd(dir.as_ref().as_os_str());
         self
     }
 
@@ -770,7 +770,7 @@ mod tests {
         // test changing to the parent of os::getcwd() because we know
         // the path exists (and os::getcwd() is not expected to be root)
         let parent_dir = os::getcwd().unwrap().dir_path();
-        let result = pwd_cmd().current_dir(&parent_dir).output().unwrap();
+        let result = pwd_cmd().current_dir(parent_dir.as_str().unwrap()).output().unwrap();
 
         let output = String::from_utf8(result.stdout).unwrap();
         let child_dir = old_path::Path::new(output.trim());
diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs
index 69053252ed1..656ca980624 100644
--- a/src/libstd/rand/mod.rs
+++ b/src/libstd/rand/mod.rs
@@ -58,6 +58,7 @@
 //! # Examples
 //!
 //! ```rust
+//! # #![feature(rand)]
 //! use std::rand;
 //! use std::rand::Rng;
 //!
@@ -68,6 +69,7 @@
 //! ```
 //!
 //! ```rust
+//! # #![feature(rand)]
 //! use std::rand;
 //!
 //! let tuple = rand::random::<(f64, char)>();
@@ -92,6 +94,7 @@
 //! multiply this fraction by 4.
 //!
 //! ```
+//! # #![feature(rand)]
 //! use std::rand;
 //! use std::rand::distributions::{IndependentSample, Range};
 //!
@@ -134,6 +137,7 @@
 //! [Monty Hall Problem]: http://en.wikipedia.org/wiki/Monty_Hall_problem
 //!
 //! ```
+//! # #![feature(rand)]
 //! use std::rand;
 //! use std::rand::Rng;
 //! use std::rand::distributions::{IndependentSample, Range};
@@ -384,6 +388,7 @@ impl Rng for ThreadRng {
 /// # Examples
 ///
 /// ```
+/// # #![feature(rand)]
 /// use std::rand;
 ///
 /// let x: u8 = rand::random();
@@ -400,6 +405,7 @@ impl Rng for ThreadRng {
 /// Caching the thread local random number generator:
 ///
 /// ```
+/// # #![feature(rand)]
 /// use std::rand;
 /// use std::rand::Rng;
 ///
@@ -427,6 +433,7 @@ pub fn random<T: Rand>() -> T {
 /// # Examples
 ///
 /// ```
+/// # #![feature(rand)]
 /// use std::rand::{thread_rng, sample};
 ///
 /// let mut rng = thread_rng();
diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs
index 5231b122b9e..d3a8fa864fc 100644
--- a/src/libstd/rand/reader.rs
+++ b/src/libstd/rand/reader.rs
@@ -24,6 +24,7 @@ use result::Result::{Ok, Err};
 /// # Examples
 ///
 /// ```
+/// # #![feature(rand, old_io)]
 /// use std::rand::{reader, Rng};
 /// use std::old_io::MemReader;
 ///
diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs
index 4430cc3b0af..69c5267ab69 100644
--- a/src/libstd/sync/condvar.rs
+++ b/src/libstd/sync/condvar.rs
@@ -69,6 +69,7 @@ pub struct Condvar { inner: Box<StaticCondvar> }
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::sync::{StaticCondvar, CONDVAR_INIT};
 ///
 /// static CVAR: StaticCondvar = CONDVAR_INIT;
diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs
index ee9bcd3dd89..3c7fecb7515 100644
--- a/src/libstd/sync/future.rs
+++ b/src/libstd/sync/future.rs
@@ -14,6 +14,7 @@
 //! # Examples
 //!
 //! ```
+//! # #![feature(std_misc)]
 //! use std::sync::Future;
 //!
 //! // a fake, for now
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index 123dad978f5..7adfd9154ac 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -119,6 +119,7 @@
 //! after 10 seconds no matter what:
 //!
 //! ```no_run
+//! # #![feature(std_misc, old_io)]
 //! use std::sync::mpsc::channel;
 //! use std::old_io::timer::Timer;
 //! use std::time::Duration;
@@ -143,6 +144,7 @@
 //! has been inactive for 5 seconds:
 //!
 //! ```no_run
+//! # #![feature(std_misc, old_io)]
 //! use std::sync::mpsc::channel;
 //! use std::old_io::timer::Timer;
 //! use std::time::Duration;
@@ -977,7 +979,7 @@ impl<T> fmt::Display for SendError<T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> error::Error for SendError<T> {
+impl<T: Send> error::Error for SendError<T> {
 
     fn description(&self) -> &str {
         "sending on a closed channel"
@@ -1013,7 +1015,7 @@ impl<T> fmt::Display for TrySendError<T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> error::Error for TrySendError<T> {
+impl<T: Send> error::Error for TrySendError<T> {
 
     fn description(&self) -> &str {
         match *self {
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index b5739c36aa9..0f936641cdc 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -27,6 +27,7 @@
 //! # Examples
 //!
 //! ```rust
+//! # #![feature(std_misc)]
 //! use std::sync::mpsc::channel;
 //!
 //! let (tx1, rx1) = channel();
@@ -119,6 +120,7 @@ impl Select {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(std_misc)]
     /// use std::sync::mpsc::Select;
     ///
     /// let select = Select::new();
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 130fd1d7dc8..2bf75cf1d37 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -85,6 +85,7 @@ use fmt;
 /// To recover from a poisoned mutex:
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::sync::{Arc, Mutex};
 /// use std::thread;
 ///
@@ -136,6 +137,7 @@ unsafe impl<T: Send> Sync for Mutex<T> { }
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::sync::{StaticMutex, MUTEX_INIT};
 ///
 /// static LOCK: StaticMutex = MUTEX_INIT;
diff --git a/src/libstd/sync/poison.rs b/src/libstd/sync/poison.rs
index 2587ff5238e..c07c83d37f4 100644
--- a/src/libstd/sync/poison.rs
+++ b/src/libstd/sync/poison.rs
@@ -105,11 +105,11 @@ impl<T> fmt::Debug for PoisonError<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<T> fmt::Display for PoisonError<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        self.description().fmt(f)
+        "poisoned lock: another task failed inside".fmt(f)
     }
 }
 
-impl<T> Error for PoisonError<T> {
+impl<T: Send> Error for PoisonError<T> {
     fn description(&self) -> &str {
         "poisoned lock: another task failed inside"
     }
@@ -161,13 +161,13 @@ impl<T> fmt::Debug for TryLockError<T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<T> fmt::Display for TryLockError<T> {
+impl<T: Send> fmt::Display for TryLockError<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         self.description().fmt(f)
     }
 }
 
-impl<T> Error for TryLockError<T> {
+impl<T: Send> Error for TryLockError<T> {
     fn description(&self) -> &str {
         match *self {
             TryLockError::Poisoned(ref p) => p.description(),
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 368e88e4e8b..6e94db6d753 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -77,6 +77,7 @@ unsafe impl<T: Send + Sync> Sync for RwLock<T> {}
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::sync::{StaticRwLock, RW_LOCK_INIT};
 ///
 /// static LOCK: StaticRwLock = RW_LOCK_INIT;
diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs
index 2f9873950b6..059cce57245 100644
--- a/src/libstd/sync/semaphore.rs
+++ b/src/libstd/sync/semaphore.rs
@@ -25,6 +25,7 @@ use sync::{Mutex, Condvar};
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc)]
 /// use std::sync::Semaphore;
 ///
 /// // Create a semaphore that represents 5 resources
diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs
index 8a1946b86ab..51cf70e615b 100644
--- a/src/libstd/sync/task_pool.rs
+++ b/src/libstd/sync/task_pool.rs
@@ -61,6 +61,7 @@ impl<'a> Drop for Sentinel<'a> {
 /// # Examples
 ///
 /// ```
+/// # #![feature(std_misc, core)]
 /// use std::sync::TaskPool;
 /// use std::iter::AdditiveIterator;
 /// use std::sync::mpsc::channel;
diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs
index e4985e703ba..90526b8f4f3 100644
--- a/src/libstd/sys/common/thread_info.rs
+++ b/src/libstd/sys/common/thread_info.rs
@@ -15,7 +15,7 @@ use core::prelude::*;
 use cell::RefCell;
 use string::String;
 use thread::Thread;
-use thread_local::State;
+use thread::LocalKeyState;
 
 struct ThreadInfo {
     stack_guard: uint,
@@ -26,7 +26,7 @@ thread_local! { static THREAD_INFO: RefCell<Option<ThreadInfo>> = RefCell::new(N
 
 impl ThreadInfo {
     fn with<R, F>(f: F) -> R where F: FnOnce(&mut ThreadInfo) -> R {
-        if THREAD_INFO.state() == State::Destroyed {
+        if THREAD_INFO.state() == LocalKeyState::Destroyed {
             panic!("Use of std::thread::current() is not possible after \
                     the thread's local data has been destroyed");
         }
diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs
index 3cc91bf54b4..9f3dae34c7a 100644
--- a/src/libstd/sys/common/wtf8.rs
+++ b/src/libstd/sys/common/wtf8.rs
@@ -634,6 +634,7 @@ impl Wtf8 {
 ///
 /// Panics when `begin` and `end` do not point to code point boundaries,
 /// or point beyond the end of the string.
+#[cfg(stage0)]
 impl ops::Index<ops::Range<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -650,12 +651,36 @@ impl ops::Index<ops::Range<usize>> for Wtf8 {
     }
 }
 
+/// Return a slice of the given string for the byte range [`begin`..`end`).
+///
+/// # Panics
+///
+/// Panics when `begin` and `end` do not point to code point boundaries,
+/// or point beyond the end of the string.
+#[cfg(not(stage0))]
+impl ops::Index<ops::Range<usize>> for Wtf8 {
+    type Output = Wtf8;
+
+    #[inline]
+    fn index(&self, range: ops::Range<usize>) -> &Wtf8 {
+        // is_code_point_boundary checks that the index is in [0, .len()]
+        if range.start <= range.end &&
+           is_code_point_boundary(self, range.start) &&
+           is_code_point_boundary(self, range.end) {
+            unsafe { slice_unchecked(self, range.start, range.end) }
+        } else {
+            slice_error_fail(self, range.start, range.end)
+        }
+    }
+}
+
 /// Return a slice of the given string from byte `begin` to its end.
 ///
 /// # Panics
 ///
 /// Panics when `begin` is not at a code point boundary,
 /// or is beyond the end of the string.
+#[cfg(stage0)]
 impl ops::Index<ops::RangeFrom<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -670,12 +695,34 @@ impl ops::Index<ops::RangeFrom<usize>> for Wtf8 {
     }
 }
 
+/// Return a slice of the given string from byte `begin` to its end.
+///
+/// # Panics
+///
+/// Panics when `begin` is not at a code point boundary,
+/// or is beyond the end of the string.
+#[cfg(not(stage0))]
+impl ops::Index<ops::RangeFrom<usize>> for Wtf8 {
+    type Output = Wtf8;
+
+    #[inline]
+    fn index(&self, range: ops::RangeFrom<usize>) -> &Wtf8 {
+        // is_code_point_boundary checks that the index is in [0, .len()]
+        if is_code_point_boundary(self, range.start) {
+            unsafe { slice_unchecked(self, range.start, self.len()) }
+        } else {
+            slice_error_fail(self, range.start, self.len())
+        }
+    }
+}
+
 /// Return a slice of the given string from its beginning to byte `end`.
 ///
 /// # Panics
 ///
 /// Panics when `end` is not at a code point boundary,
 /// or is beyond the end of the string.
+#[cfg(stage0)]
 impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
     type Output = Wtf8;
 
@@ -690,6 +737,28 @@ impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
     }
 }
 
+/// Return a slice of the given string from its beginning to byte `end`.
+///
+/// # Panics
+///
+/// Panics when `end` is not at a code point boundary,
+/// or is beyond the end of the string.
+#[cfg(not(stage0))]
+impl ops::Index<ops::RangeTo<usize>> for Wtf8 {
+    type Output = Wtf8;
+
+    #[inline]
+    fn index(&self, range: ops::RangeTo<usize>) -> &Wtf8 {
+        // is_code_point_boundary checks that the index is in [0, .len()]
+        if is_code_point_boundary(self, range.end) {
+            unsafe { slice_unchecked(self, 0, range.end) }
+        } else {
+            slice_error_fail(self, 0, range.end)
+        }
+    }
+}
+
+#[cfg(stage0)]
 impl ops::Index<ops::RangeFull> for Wtf8 {
     type Output = Wtf8;
 
@@ -699,6 +768,16 @@ impl ops::Index<ops::RangeFull> for Wtf8 {
     }
 }
 
+#[cfg(not(stage0))]
+impl ops::Index<ops::RangeFull> for Wtf8 {
+    type Output = Wtf8;
+
+    #[inline]
+    fn index(&self, _range: ops::RangeFull) -> &Wtf8 {
+        self
+    }
+}
+
 #[inline]
 fn decode_surrogate(second_byte: u8, third_byte: u8) -> u16 {
     // The first byte is assumed to be 0xED
diff --git a/src/libstd/sys/unix/fs2.rs b/src/libstd/sys/unix/fs2.rs
index ea74aab3331..202e5ddaec4 100644
--- a/src/libstd/sys/unix/fs2.rs
+++ b/src/libstd/sys/unix/fs2.rs
@@ -338,8 +338,7 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> {
         }));
         buf.set_len(n as usize);
     }
-    let s: OsString = OsStringExt::from_vec(buf);
-    Ok(PathBuf::new(&s))
+    Ok(PathBuf::from(OsString::from_vec(buf)))
 }
 
 pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> {
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index a5a2f71acb7..6c191689255 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -36,7 +36,7 @@ const BUF_BYTES: usize = 2048;
 const TMPBUF_SZ: usize = 128;
 
 fn bytes2path(b: &[u8]) -> PathBuf {
-    PathBuf::new(<OsStr as OsStrExt>::from_bytes(b))
+    PathBuf::from(<OsStr as OsStrExt>::from_bytes(b))
 }
 
 fn os2path(os: OsString) -> PathBuf {
@@ -253,7 +253,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
         let err = _NSGetExecutablePath(v.as_mut_ptr() as *mut i8, &mut sz);
         if err != 0 { return Err(io::Error::last_os_error()); }
         v.set_len(sz as uint - 1); // chop off trailing NUL
-        Ok(PathBuf::new(OsString::from_vec(v)))
+        Ok(PathBuf::from(OsString::from_vec(v)))
     }
 }
 
@@ -466,9 +466,9 @@ pub fn page_size() -> usize {
 pub fn temp_dir() -> PathBuf {
     getenv("TMPDIR".as_os_str()).map(os2path).unwrap_or_else(|| {
         if cfg!(target_os = "android") {
-            PathBuf::new("/data/local/tmp")
+            PathBuf::from("/data/local/tmp")
         } else {
-            PathBuf::new("/tmp")
+            PathBuf::from("/tmp")
         }
     })
 }
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs
index c5f07c6c75a..eb61f21aacd 100644
--- a/src/libstd/sys/unix/thread.rs
+++ b/src/libstd/sys/unix/thread.rs
@@ -227,19 +227,16 @@ pub unsafe fn create(stack: usize, p: Thunk) -> io::Result<rust_thread> {
 
 #[cfg(any(target_os = "linux", target_os = "android"))]
 pub unsafe fn set_name(name: &str) {
-    // pthread_setname_np() since glibc 2.12
-    // availability autodetected via weak linkage
-    type F = unsafe extern fn(libc::pthread_t, *const libc::c_char)
-                              -> libc::c_int;
+    // pthread wrapper only appeared in glibc 2.12, so we use syscall directly.
     extern {
-        #[linkage = "extern_weak"]
-        static pthread_setname_np: *const ();
-    }
-    if !pthread_setname_np.is_null() {
-        let cname = CString::new(name).unwrap();
-        mem::transmute::<*const (), F>(pthread_setname_np)(pthread_self(),
-                                                           cname.as_ptr());
+        fn prctl(option: libc::c_int, arg2: libc::c_ulong, arg3: libc::c_ulong,
+                 arg4: libc::c_ulong, arg5: libc::c_ulong) -> libc::c_int;
     }
+    const PR_SET_NAME: libc::c_int = 15;
+    let cname = CString::new(name).unwrap_or_else(|_| {
+        panic!("thread name may not contain interior null bytes")
+    });
+    prctl(PR_SET_NAME, cname.as_ptr() as libc::c_ulong, 0, 0, 0);
 }
 
 #[cfg(any(target_os = "freebsd",
@@ -314,26 +311,39 @@ pub fn sleep(dur: Duration) {
 // is created in an application with big thread-local storage requirements.
 // See #6233 for rationale and details.
 //
-// Link weakly to the symbol for compatibility with older versions of glibc.
-// Assumes that we've been dynamically linked to libpthread but that is
-// currently always the case.  Note that you need to check that the symbol
-// is non-null before calling it!
+// Use dlsym to get the symbol value at runtime, both for
+// compatibility with older versions of glibc, and to avoid creating
+// dependencies on GLIBC_PRIVATE symbols.  Assumes that we've been
+// dynamically linked to libpthread but that is currently always the
+// case.  We previously used weak linkage (under the same assumption),
+// but that caused Debian to detect an unnecessarily strict versioned
+// dependency on libc6 (#23628).
 #[cfg(target_os = "linux")]
 fn min_stack_size(attr: *const libc::pthread_attr_t) -> libc::size_t {
+    use dynamic_lib::DynamicLibrary;
+    use sync::{Once, ONCE_INIT};
+
     type F = unsafe extern "C" fn(*const libc::pthread_attr_t) -> libc::size_t;
-    extern {
-        #[linkage = "extern_weak"]
-        static __pthread_get_minstack: *const ();
-    }
-    if __pthread_get_minstack.is_null() {
-        PTHREAD_STACK_MIN
-    } else {
-        unsafe { mem::transmute::<*const (), F>(__pthread_get_minstack)(attr) }
+    static INIT: Once = ONCE_INIT;
+    static mut __pthread_get_minstack: Option<F> = None;
+
+    INIT.call_once(|| {
+        let lib = DynamicLibrary::open(None).unwrap();
+        unsafe {
+            if let Ok(f) = lib.symbol("__pthread_get_minstack") {
+                __pthread_get_minstack = Some(mem::transmute::<*const (), F>(f));
+            }
+        }
+    });
+
+    match unsafe { __pthread_get_minstack } {
+        None => PTHREAD_STACK_MIN,
+        Some(f) => unsafe { f(attr) },
     }
 }
 
-// __pthread_get_minstack() is marked as weak but extern_weak linkage is
-// not supported on OS X, hence this kludge...
+// No point in looking up __pthread_get_minstack() on non-glibc
+// platforms.
 #[cfg(not(target_os = "linux"))]
 fn min_stack_size(_: *const libc::pthread_attr_t) -> libc::size_t {
     PTHREAD_STACK_MIN
diff --git a/src/libstd/sys/windows/fs2.rs b/src/libstd/sys/windows/fs2.rs
index 117f819eeeb..99835265111 100644
--- a/src/libstd/sys/windows/fs2.rs
+++ b/src/libstd/sys/windows/fs2.rs
@@ -372,7 +372,7 @@ pub fn readlink(p: &Path) -> io::Result<PathBuf> {
                                   sz - 1,
                                   libc::VOLUME_NAME_DOS)
     }, |s| OsStringExt::from_wide(s)));
-    Ok(PathBuf::new(&ret))
+    Ok(PathBuf::from(&ret))
 }
 
 pub fn symlink(src: &Path, dst: &Path) -> io::Result<()> {
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index eeaf4ced072..b1ceac9b902 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -304,9 +304,7 @@ fn fill_utf16_buf_new<F1, F2, T>(f1: F1, f2: F2) -> io::Result<T>
 }
 
 fn os2path(s: &[u16]) -> PathBuf {
-    let os = <OsString as OsStringExt>::from_wide(s);
-    // FIXME(#22751) should consume `os`
-    PathBuf::new(&os)
+    PathBuf::from(OsString::from_wide(s))
 }
 
 pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs
index 4f6c4c9aab3..83d06371734 100644
--- a/src/libstd/sys/windows/os.rs
+++ b/src/libstd/sys/windows/os.rs
@@ -363,10 +363,7 @@ pub fn temp_dir() -> PathBuf {
 pub fn home_dir() -> Option<PathBuf> {
     getenv("HOME".as_os_str()).or_else(|| {
         getenv("USERPROFILE".as_os_str())
-    }).map(|os| {
-        // FIXME(#22751) should consume `os`
-        PathBuf::new(&os)
-    }).or_else(|| unsafe {
+    }).map(PathBuf::from).or_else(|| unsafe {
         let me = c::GetCurrentProcess();
         let mut token = ptr::null_mut();
         if c::OpenProcessToken(me, c::TOKEN_READ, &mut token) == 0 {
diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread/local.rs
index 08780292c88..1bf1b09681c 100644
--- a/src/libstd/thread_local/mod.rs
+++ b/src/libstd/thread/local.rs
@@ -9,40 +9,13 @@
 // except according to those terms.
 
 //! Thread local storage
-//!
-//! This module provides an implementation of thread local storage for Rust
-//! programs. Thread local storage is a method of storing data into a global
-//! variable which each thread in the program will have its own copy of.
-//! Threads do not share this data, so accesses do not need to be synchronized.
-//!
-//! At a high level, this module provides two variants of storage:
-//!
-//! * Owning thread local storage. This is a type of thread local key which
-//!   owns the value that it contains, and will destroy the value when the
-//!   thread exits. This variant is created with the `thread_local!` macro and
-//!   can contain any value which is `'static` (no borrowed pointers.
-//!
-//! * Scoped thread local storage. This type of key is used to store a reference
-//!   to a value into local storage temporarily for the scope of a function
-//!   call. There are no restrictions on what types of values can be placed
-//!   into this key.
-//!
-//! Both forms of thread local storage provide an accessor function, `with`,
-//! which will yield a shared reference to the value to the specified
-//! closure. Thread local keys only allow shared access to values as there is no
-//! way to guarantee uniqueness if a mutable borrow was allowed. Most values
-//! will want to make use of some form of **interior mutability** through the
-//! `Cell` or `RefCell` types.
-
-#![stable(feature = "rust1", since = "1.0.0")]
+
+#![unstable(feature = "thread_local_internals")]
 
 use prelude::v1::*;
 
 use cell::UnsafeCell;
 
-#[macro_use]
-pub mod scoped;
-
 // Sure wish we had macro hygiene, no?
 #[doc(hidden)]
 #[unstable(feature = "thread_local_internals")]
@@ -95,7 +68,7 @@ pub mod __impl {
 /// });
 /// ```
 #[stable(feature = "rust1", since = "1.0.0")]
-pub struct Key<T> {
+pub struct LocalKey<T> {
     // The key itself may be tagged with #[thread_local], and this `Key` is
     // stored as a `static`, and it's not valid for a static to reference the
     // address of another thread_local static. For this reason we kinda wonkily
@@ -114,15 +87,15 @@ pub struct Key<T> {
     pub init: fn() -> T,
 }
 
-/// Declare a new thread local storage key of type `std::thread_local::Key`.
+/// Declare a new thread local storage key of type `std::thread::LocalKey`.
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow_internal_unstable]
 macro_rules! thread_local {
     (static $name:ident: $t:ty = $init:expr) => (
-        static $name: ::std::thread_local::Key<$t> = {
+        static $name: ::std::thread::LocalKey<$t> = {
             use std::cell::UnsafeCell as __UnsafeCell;
-            use std::thread_local::__impl::KeyInner as __KeyInner;
+            use std::thread::__local::__impl::KeyInner as __KeyInner;
             use std::option::Option as __Option;
             use std::option::Option::None as __None;
 
@@ -133,13 +106,13 @@ macro_rules! thread_local {
             fn __getit() -> &'static __KeyInner<__UnsafeCell<__Option<$t>>> {
                 &__KEY
             }
-            ::std::thread_local::Key { inner: __getit, init: __init }
+            ::std::thread::LocalKey { inner: __getit, init: __init }
         };
     );
     (pub static $name:ident: $t:ty = $init:expr) => (
-        pub static $name: ::std::thread_local::Key<$t> = {
+        pub static $name: ::std::thread::LocalKey<$t> = {
             use std::cell::UnsafeCell as __UnsafeCell;
-            use std::thread_local::__impl::KeyInner as __KeyInner;
+            use std::thread::__local::__impl::KeyInner as __KeyInner;
             use std::option::Option as __Option;
             use std::option::Option::None as __None;
 
@@ -150,7 +123,7 @@ macro_rules! thread_local {
             fn __getit() -> &'static __KeyInner<__UnsafeCell<__Option<$t>>> {
                 &__KEY
             }
-            ::std::thread_local::Key { inner: __getit, init: __init }
+            ::std::thread::LocalKey { inner: __getit, init: __init }
         };
     );
 }
@@ -183,20 +156,20 @@ macro_rules! __thread_local_inner {
         #[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
                        not(target_arch = "aarch64")),
                    thread_local)]
-        static $name: ::std::thread_local::__impl::KeyInner<$t> =
+        static $name: ::std::thread::__local::__impl::KeyInner<$t> =
             __thread_local_inner!($init, $t);
     );
     (pub static $name:ident: $t:ty = $init:expr) => (
         #[cfg_attr(all(any(target_os = "macos", target_os = "linux"),
                        not(target_arch = "aarch64")),
                    thread_local)]
-        pub static $name: ::std::thread_local::__impl::KeyInner<$t> =
+        pub static $name: ::std::thread::__local::__impl::KeyInner<$t> =
             __thread_local_inner!($init, $t);
     );
     ($init:expr, $t:ty) => ({
         #[cfg(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")))]
-        const _INIT: ::std::thread_local::__impl::KeyInner<$t> = {
-            ::std::thread_local::__impl::KeyInner {
+        const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = {
+            ::std::thread::__local::__impl::KeyInner {
                 inner: ::std::cell::UnsafeCell { value: $init },
                 dtor_registered: ::std::cell::UnsafeCell { value: false },
                 dtor_running: ::std::cell::UnsafeCell { value: false },
@@ -204,16 +177,14 @@ macro_rules! __thread_local_inner {
         };
 
         #[cfg(any(not(any(target_os = "macos", target_os = "linux")), target_arch = "aarch64"))]
-        const _INIT: ::std::thread_local::__impl::KeyInner<$t> = {
-            unsafe extern fn __destroy(ptr: *mut u8) {
-                ::std::thread_local::__impl::destroy_value::<$t>(ptr);
-            }
-
-            ::std::thread_local::__impl::KeyInner {
+        const _INIT: ::std::thread::__local::__impl::KeyInner<$t> = {
+            ::std::thread::__local::__impl::KeyInner {
                 inner: ::std::cell::UnsafeCell { value: $init },
-                os: ::std::thread_local::__impl::OsStaticKey {
-                    inner: ::std::thread_local::__impl::OS_INIT_INNER,
-                    dtor: ::std::option::Option::Some(__destroy as unsafe extern fn(*mut u8)),
+                os: ::std::thread::__local::__impl::OsStaticKey {
+                    inner: ::std::thread::__local::__impl::OS_INIT_INNER,
+                    dtor: ::std::option::Option::Some(
+                        ::std::thread::__local::__impl::destroy_value::<$t>
+                    ),
                 },
             }
         };
@@ -226,7 +197,7 @@ macro_rules! __thread_local_inner {
 #[unstable(feature = "std_misc",
            reason = "state querying was recently added")]
 #[derive(Eq, PartialEq, Copy)]
-pub enum State {
+pub enum LocalKeyState {
     /// All keys are in this state whenever a thread starts. Keys will
     /// transition to the `Valid` state once the first call to `with` happens
     /// and the initialization expression succeeds.
@@ -253,7 +224,7 @@ pub enum State {
     Destroyed,
 }
 
-impl<T: 'static> Key<T> {
+impl<T: 'static> LocalKey<T> {
     /// Acquire a reference to the value in this TLS key.
     ///
     /// This will lazily initialize the value if this thread has not referenced
@@ -309,16 +280,16 @@ impl<T: 'static> Key<T> {
     /// any call to `with`.
     #[unstable(feature = "std_misc",
                reason = "state querying was recently added")]
-    pub fn state(&'static self) -> State {
+    pub fn state(&'static self) -> LocalKeyState {
         unsafe {
             match (self.inner)().get() {
                 Some(cell) => {
                     match *cell.get() {
-                        Some(..) => State::Valid,
-                        None => State::Uninitialized,
+                        Some(..) => LocalKeyState::Valid,
+                        None => LocalKeyState::Uninitialized,
                     }
                 }
-                None => State::Destroyed,
+                None => LocalKeyState::Destroyed,
             }
         }
     }
@@ -327,7 +298,7 @@ impl<T: 'static> Key<T> {
     #[unstable(feature = "std_misc")]
     #[deprecated(since = "1.0.0",
                  reason = "function renamed to state() and returns more info")]
-    pub fn destroyed(&'static self) -> bool { self.state() == State::Destroyed }
+    pub fn destroyed(&'static self) -> bool { self.state() == LocalKeyState::Destroyed }
 }
 
 #[cfg(all(any(target_os = "macos", target_os = "linux"), not(target_arch = "aarch64")))]
@@ -553,7 +524,7 @@ mod tests {
 
     use sync::mpsc::{channel, Sender};
     use cell::UnsafeCell;
-    use super::State;
+    use super::LocalKeyState;
     use thread;
 
     struct Foo(Sender<()>);
@@ -592,21 +563,21 @@ mod tests {
         struct Foo;
         impl Drop for Foo {
             fn drop(&mut self) {
-                assert!(FOO.state() == State::Destroyed);
+                assert!(FOO.state() == LocalKeyState::Destroyed);
             }
         }
         fn foo() -> Foo {
-            assert!(FOO.state() == State::Uninitialized);
+            assert!(FOO.state() == LocalKeyState::Uninitialized);
             Foo
         }
         thread_local!(static FOO: Foo = foo());
 
         thread::spawn(|| {
-            assert!(FOO.state() == State::Uninitialized);
+            assert!(FOO.state() == LocalKeyState::Uninitialized);
             FOO.with(|_| {
-                assert!(FOO.state() == State::Valid);
+                assert!(FOO.state() == LocalKeyState::Valid);
             });
-            assert!(FOO.state() == State::Valid);
+            assert!(FOO.state() == LocalKeyState::Valid);
         }).join().ok().unwrap();
     }
 
@@ -642,7 +613,7 @@ mod tests {
             fn drop(&mut self) {
                 unsafe {
                     HITS += 1;
-                    if K2.state() == State::Destroyed {
+                    if K2.state() == LocalKeyState::Destroyed {
                         assert_eq!(HITS, 3);
                     } else {
                         if HITS == 1 {
@@ -658,7 +629,7 @@ mod tests {
             fn drop(&mut self) {
                 unsafe {
                     HITS += 1;
-                    assert!(K1.state() != State::Destroyed);
+                    assert!(K1.state() != LocalKeyState::Destroyed);
                     assert_eq!(HITS, 2);
                     K1.with(|s| *s.get() = Some(S1));
                 }
@@ -679,7 +650,7 @@ mod tests {
 
         impl Drop for S1 {
             fn drop(&mut self) {
-                assert!(K1.state() == State::Destroyed);
+                assert!(K1.state() == LocalKeyState::Destroyed);
             }
         }
 
@@ -702,7 +673,7 @@ mod tests {
             fn drop(&mut self) {
                 let S1(ref tx) = *self;
                 unsafe {
-                    if K2.state() != State::Destroyed {
+                    if K2.state() != LocalKeyState::Destroyed {
                         K2.with(|s| *s.get() = Some(Foo(tx.clone())));
                     }
                 }
@@ -745,7 +716,7 @@ mod dynamic_tests {
         thread_local!(static FOO: RefCell<HashMap<i32, i32>> = map());
 
         FOO.with(|map| {
-            assert_eq!(map.borrow()[1], 2);
+            assert_eq!(map.borrow()[&1], 2);
         });
     }
 
diff --git a/src/libstd/thread.rs b/src/libstd/thread/mod.rs
index ab74442cac9..57baeb1fb74 100644
--- a/src/libstd/thread.rs
+++ b/src/libstd/thread/mod.rs
@@ -138,9 +138,43 @@
 //!   synchronization primitives; the threads already provide basic blocking/signaling.
 //!
 //! * It can be implemented very efficiently on many platforms.
+//!
+//! ## Thread-local storage
+//!
+//! This module also provides an implementation of thread local storage for Rust
+//! programs. Thread local storage is a method of storing data into a global
+//! variable which each thread in the program will have its own copy of.
+//! Threads do not share this data, so accesses do not need to be synchronized.
+//!
+//! At a high level, this module provides two variants of storage:
+//!
+//! * Owned thread-local storage. This is a type of thread local key which
+//!   owns the value that it contains, and will destroy the value when the
+//!   thread exits. This variant is created with the `thread_local!` macro and
+//!   can contain any value which is `'static` (no borrowed pointers).
+//!
+//! * Scoped thread-local storage. This type of key is used to store a reference
+//!   to a value into local storage temporarily for the scope of a function
+//!   call. There are no restrictions on what types of values can be placed
+//!   into this key.
+//!
+//! Both forms of thread local storage provide an accessor function, `with`,
+//! which will yield a shared reference to the value to the specified
+//! closure. Thread-local keys only allow shared access to values as there is no
+//! way to guarantee uniqueness if a mutable borrow was allowed. Most values
+//! will want to make use of some form of **interior mutability** through the
+//! `Cell` or `RefCell` types.
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
+#[stable(feature = "rust1", since = "1.0.0")]
+pub use self::__local::{LocalKey, LocalKeyState};
+
+#[unstable(feature = "scoped_tls",
+            reason = "scoped TLS has yet to have wide enough use to fully consider \
+                      stabilizing its interface")]
+pub use self::__scoped::ScopedKey;
+
 use prelude::v1::*;
 
 use any::Any;
@@ -157,6 +191,22 @@ use time::Duration;
 
 #[allow(deprecated)] use old_io::Writer;
 
+////////////////////////////////////////////////////////////////////////////////
+// Thread-local storage
+////////////////////////////////////////////////////////////////////////////////
+
+#[macro_use]
+#[doc(hidden)]
+#[path = "local.rs"] pub mod __local;
+
+#[macro_use]
+#[doc(hidden)]
+#[path = "scoped.rs"] pub mod __scoped;
+
+////////////////////////////////////////////////////////////////////////////////
+// Builder
+////////////////////////////////////////////////////////////////////////////////
+
 /// Thread configuration. Provides detailed control over the properties
 /// and behavior of new threads.
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -322,6 +372,10 @@ impl Builder {
     }
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Free functions
+////////////////////////////////////////////////////////////////////////////////
+
 /// Spawn a new thread, returning a `JoinHandle` for it.
 ///
 /// The join handle will implicitly *detach* the child thread upon being
@@ -433,6 +487,10 @@ pub fn park_timeout(duration: Duration) {
     *guard = false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Thread
+////////////////////////////////////////////////////////////////////////////////
+
 /// The internal representation of a `Thread` handle
 struct Inner {
     name: Option<String>,
@@ -557,6 +615,10 @@ impl thread_info::NewThread for Thread {
     fn new(name: Option<String>) -> Thread { Thread::new(name) }
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// JoinHandle and JoinGuard
+////////////////////////////////////////////////////////////////////////////////
+
 /// Indicates the manner in which a thread exited.
 ///
 /// A thread that completes without panicking is considered to exit successfully.
@@ -689,6 +751,10 @@ impl<'a, T: Send + 'a> Drop for JoinGuard<'a, T> {
     }
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// Tests
+////////////////////////////////////////////////////////////////////////////////
+
 #[cfg(test)]
 mod test {
     use prelude::v1::*;
diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread/scoped.rs
index 86e6c059a70..b384879d7a9 100644
--- a/src/libstd/thread_local/scoped.rs
+++ b/src/libstd/thread/scoped.rs
@@ -24,6 +24,7 @@
 //! # Examples
 //!
 //! ```
+//! # #![feature(scoped_tls)]
 //! scoped_thread_local!(static FOO: u32);
 //!
 //! // Initially each scoped slot is empty.
@@ -38,9 +39,7 @@
 //! });
 //! ```
 
-#![unstable(feature = "std_misc",
-            reason = "scoped TLS has yet to have wide enough use to fully consider \
-                      stabilizing its interface")]
+#![unstable(feature = "thread_local_internals")]
 
 use prelude::v1::*;
 
@@ -58,7 +57,10 @@ pub mod __impl {
 /// type `T` scoped to a particular lifetime. Keys provides two methods, `set`
 /// and `with`, both of which currently use closures to control the scope of
 /// their contents.
-pub struct Key<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
+#[unstable(feature = "scoped_tls",
+           reason = "scoped TLS has yet to have wide enough use to fully consider \
+                     stabilizing its interface")]
+pub struct ScopedKey<T> { #[doc(hidden)] pub inner: __impl::KeyInner<T> }
 
 /// Declare a new scoped thread local storage key.
 ///
@@ -86,7 +88,7 @@ macro_rules! __scoped_thread_local_inner {
                            target_os = "openbsd",
                            target_arch = "aarch64")),
                    thread_local)]
-        static $name: ::std::thread_local::scoped::Key<$t> =
+        static $name: ::std::thread::ScopedKey<$t> =
             __scoped_thread_local_inner!($t);
     );
     (pub static $name:ident: $t:ty) => (
@@ -96,11 +98,11 @@ macro_rules! __scoped_thread_local_inner {
                            target_os = "openbsd",
                            target_arch = "aarch64")),
                    thread_local)]
-        pub static $name: ::std::thread_local::scoped::Key<$t> =
+        pub static $name: ::std::thread::ScopedKey<$t> =
             __scoped_thread_local_inner!($t);
     );
     ($t:ty) => ({
-        use std::thread_local::scoped::Key as __Key;
+        use std::thread::ScopedKey as __Key;
 
         #[cfg(not(any(windows,
                       target_os = "android",
@@ -108,7 +110,7 @@ macro_rules! __scoped_thread_local_inner {
                       target_os = "openbsd",
                       target_arch = "aarch64")))]
         const _INIT: __Key<$t> = __Key {
-            inner: ::std::thread_local::scoped::__impl::KeyInner {
+            inner: ::std::thread::__scoped::__impl::KeyInner {
                 inner: ::std::cell::UnsafeCell { value: 0 as *mut _ },
             }
         };
@@ -119,8 +121,8 @@ macro_rules! __scoped_thread_local_inner {
                   target_os = "openbsd",
                   target_arch = "aarch64"))]
         const _INIT: __Key<$t> = __Key {
-            inner: ::std::thread_local::scoped::__impl::KeyInner {
-                inner: ::std::thread_local::scoped::__impl::OS_INIT,
+            inner: ::std::thread::__scoped::__impl::KeyInner {
+                inner: ::std::thread::__scoped::__impl::OS_INIT,
                 marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>,
             }
         };
@@ -129,7 +131,10 @@ macro_rules! __scoped_thread_local_inner {
     })
 }
 
-impl<T> Key<T> {
+#[unstable(feature = "scoped_tls",
+           reason = "scoped TLS has yet to have wide enough use to fully consider \
+                     stabilizing its interface")]
+impl<T> ScopedKey<T> {
     /// Insert a value into this scoped thread local storage slot for a
     /// duration of a closure.
     ///
@@ -142,6 +147,7 @@ impl<T> Key<T> {
     /// # Examples
     ///
     /// ```
+    /// # #![feature(scoped_tls)]
     /// scoped_thread_local!(static FOO: u32);
     ///
     /// FOO.set(&100, || {
@@ -194,6 +200,7 @@ impl<T> Key<T> {
     /// # Examples
     ///
     /// ```no_run
+    /// # #![feature(scoped_tls)]
     /// scoped_thread_local!(static FOO: u32);
     ///
     /// FOO.with(|slot| {