about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/liballoc/lib.rs1
-rw-r--r--src/liballoc/raw_vec.rs3
-rw-r--r--src/libcollections/borrow.rs4
-rw-r--r--src/libcollections/enum_set.rs1
-rw-r--r--src/libcollections/fmt.rs6
-rw-r--r--src/libcollections/lib.rs1
-rw-r--r--src/libcollections/slice.rs33
-rw-r--r--src/libcollections/string.rs14
-rw-r--r--src/libcollections/vec.rs11
-rw-r--r--src/libcollections/vec_deque.rs6
-rw-r--r--src/libcore/fmt/builders.rs1
-rw-r--r--src/libcore/fmt/mod.rs10
-rw-r--r--src/libcore/fmt/num.rs5
-rw-r--r--src/libcore/hash/mod.rs5
-rw-r--r--src/libcore/num/flt2dec/mod.rs4
-rw-r--r--src/libcore/num/int_macros.rs6
-rw-r--r--src/libcore/num/mod.rs122
-rw-r--r--src/libcore/num/uint_macros.rs4
-rw-r--r--src/libcore/num/usize.rs5
-rw-r--r--src/libcore/num/wrapping.rs7
-rw-r--r--src/libcore/slice.rs17
-rw-r--r--src/libcore/str/mod.rs14
-rw-r--r--src/libcoretest/num/flt2dec/mod.rs4
-rw-r--r--src/libgraphviz/lib.rs37
-rw-r--r--src/librbml/lib.rs3
-rw-r--r--src/librustc/lib.rs4
-rw-r--r--src/librustc/middle/cfg/graphviz.rs3
-rw-r--r--src/librustc/middle/const_eval.rs4
-rw-r--r--src/librustc/middle/dataflow.rs16
-rw-r--r--src/librustc/mir/repr.rs3
-rw-r--r--src/librustc_back/lib.rs1
-rw-r--r--src/librustc_borrowck/graphviz.rs2
-rw-r--r--src/librustc_borrowck/lib.rs1
-rw-r--r--src/librustc_lint/lib.rs1
-rw-r--r--src/librustc_lint/types.rs16
-rw-r--r--src/librustc_trans/lib.rs2
-rw-r--r--src/librustc_trans/trans/assert_dep_graph.rs2
-rw-r--r--src/librustc_trans/trans/debuginfo/metadata.rs4
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/lib.rs1
-rw-r--r--src/libserialize/collection_impls.rs5
-rw-r--r--src/libserialize/lib.rs1
-rw-r--r--src/libstd/collections/hash/table.rs1
-rw-r--r--src/libstd/ffi/c_str.rs32
-rw-r--r--src/libstd/io/cursor.rs11
-rw-r--r--src/libstd/io/impls.rs2
-rw-r--r--src/libstd/lib.rs3
-rw-r--r--src/libstd/memchr.rs28
-rw-r--r--src/libstd/net/ip.rs23
-rw-r--r--src/libstd/net/parser.rs2
-rw-r--r--src/libstd/path.rs49
-rw-r--r--src/libstd/sync/mod.rs1
-rw-r--r--src/libstd/sync/semaphore.rs4
-rw-r--r--src/libstd/sys/unix/ext/fs.rs19
-rw-r--r--src/rustbook/book.rs6
-rw-r--r--src/rustbook/main.rs1
-rw-r--r--src/test/compile-fail/lint-exceeding-bitshifts.rs11
-rw-r--r--src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs6
58 files changed, 356 insertions, 235 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index ffa0ec4917c..0a232ed0620 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -78,7 +78,6 @@
 #![feature(custom_attribute)]
 #![feature(fundamental)]
 #![feature(lang_items)]
-#![feature(num_bits_bytes)]
 #![feature(optin_builtin_traits)]
 #![feature(placement_in_syntax)]
 #![feature(placement_new_protocol)]
diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs
index 52bd62f7a66..c407cef25e7 100644
--- a/src/liballoc/raw_vec.rs
+++ b/src/liballoc/raw_vec.rs
@@ -16,7 +16,6 @@ use super::oom;
 use super::boxed::Box;
 use core::ops::Drop;
 use core::cmp;
-use core;
 
 /// A low-level utility for more ergonomically allocating, reallocating, and deallocating a
 /// a buffer of memory on the heap without having to worry about all the corner cases
@@ -584,7 +583,7 @@ impl<T> Drop for RawVec<T> {
 
 #[inline]
 fn alloc_guard(alloc_size: usize) {
-    if core::usize::BITS < 64 {
+    if mem::size_of::<usize>() < 8 {
         assert!(alloc_size <= ::core::isize::MAX as usize,
                 "capacity overflow");
     }
diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs
index 25bfbb04a90..f174cc09bcd 100644
--- a/src/libcollections/borrow.rs
+++ b/src/libcollections/borrow.rs
@@ -247,12 +247,15 @@ impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
 /// Trait for moving into a `Cow`.
 #[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
            issue = "27735")]
+#[rustc_deprecated(since = "1.7.0",
+                   reason = "conflicts with Into, may return with specialization")]
 pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
     /// Moves `self` into `Cow`
     fn into_cow(self) -> Cow<'a, B>;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
     fn into_cow(self) -> Cow<'a, B> {
         self
@@ -260,6 +263,7 @@ impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
     fn as_ref(&self) -> &T {
         self
diff --git a/src/libcollections/enum_set.rs b/src/libcollections/enum_set.rs
index 717c1d13af4..8b8ccd526c9 100644
--- a/src/libcollections/enum_set.rs
+++ b/src/libcollections/enum_set.rs
@@ -81,6 +81,7 @@ pub trait CLike {
     fn from_usize(usize) -> Self;
 }
 
+#[allow(deprecated)]
 fn bit<E: CLike>(e: &E) -> usize {
     use core::usize;
     let value = e.to_usize();
diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs
index 1450b8efb0f..d46a3e7e89e 100644
--- a/src/libcollections/fmt.rs
+++ b/src/libcollections/fmt.rs
@@ -490,7 +490,11 @@ pub use core::fmt::{LowerExp, UpperExp};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::Error;
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt};
+pub use core::fmt::{ArgumentV1, Arguments, write};
+#[unstable(feature = "fmt_radix", issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
+#[allow(deprecated)]
+pub use core::fmt::{radix, Radix, RadixFmt};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
 
diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs
index 8b876df32af..0b13717e8a0 100644
--- a/src/libcollections/lib.rs
+++ b/src/libcollections/lib.rs
@@ -32,7 +32,6 @@
 #![feature(alloc)]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![feature(clone_from_slice)]
 #![feature(core_intrinsics)]
 #![feature(decode_utf16)]
 #![feature(drop_in_place)]
diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs
index bc5927f3d5e..8b4497e6f03 100644
--- a/src/libcollections/slice.rs
+++ b/src/libcollections/slice.rs
@@ -788,15 +788,12 @@ impl<T> [T] {
     /// # Examples
     ///
     /// ```rust
-    /// #![feature(slice_sort_by_key)]
-    ///
     /// let mut v = [-5i32, 4, 1, -3, 2];
     ///
     /// v.sort_by_key(|k| k.abs());
     /// assert!(v == [1, 2, -3, 4, -5]);
     /// ```
-    #[unstable(feature = "slice_sort_by_key", reason = "recently added",
-               issue = "27724")]
+    #[stable(feature = "slice_sort_by_key", since = "1.7.0")]
     #[inline]
     pub fn sort_by_key<B, F>(&mut self, mut f: F)
         where F: FnMut(&T) -> B, B: Ord
@@ -829,29 +826,25 @@ impl<T> [T] {
         merge_sort(self, compare)
     }
 
-    /// Copies as many elements from `src` as it can into `self` (the
-    /// shorter of `self.len()` and `src.len()`). Returns the number
-    /// of elements copied.
+    /// Copies the elements from `src` into `self`.
+    ///
+    /// The length of this slice must be the same as the slice passed in.
+    ///
+    /// # Panics
+    ///
+    /// This function will panic if the two slices have different lengths.
     ///
     /// # Example
     ///
     /// ```rust
-    /// #![feature(clone_from_slice)]
-    ///
     /// let mut dst = [0, 0, 0];
-    /// let src = [1, 2];
-    ///
-    /// assert!(dst.clone_from_slice(&src) == 2);
-    /// assert!(dst == [1, 2, 0]);
+    /// let src = [1, 2, 3];
     ///
-    /// let src2 = [3, 4, 5, 6];
-    /// assert!(dst.clone_from_slice(&src2) == 3);
-    /// assert!(dst == [3, 4, 5]);
+    /// dst.clone_from_slice(&src);
+    /// assert!(dst == [1, 2, 3]);
     /// ```
-    #[unstable(feature = "clone_from_slice", issue = "27750")]
-    pub fn clone_from_slice(&mut self, src: &[T]) -> usize
-        where T: Clone
-    {
+    #[stable(feature = "clone_from_slice", since = "1.7.0")]
+    pub fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
         core_slice::SliceExt::clone_from_slice(self, src)
     }
 
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index eb9628d6e39..ad9c770a5a5 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -66,6 +66,7 @@ use core::str::pattern::Pattern;
 use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
 use rustc_unicode::str as unicode_str;
 
+#[allow(deprecated)]
 use borrow::{Cow, IntoCow};
 use range::RangeArgument;
 use str::{self, FromStr, Utf8Error, Chars};
@@ -783,13 +784,18 @@ impl String {
 
     /// Extracts a string slice containing the entire string.
     #[inline]
-    #[unstable(feature = "convert",
-               reason = "waiting on RFC revision",
-               issue = "27729")]
+    #[stable(feature = "string_as_str", since = "1.7.0")]
     pub fn as_str(&self) -> &str {
         self
     }
 
+    /// Extracts a string slice containing the entire string.
+    #[inline]
+    #[stable(feature = "string_as_str", since = "1.7.0")]
+    pub fn as_mut_str(&mut self) -> &mut str {
+        self
+    }
+
     /// Appends a given string slice onto the end of this `String`.
     ///
     /// # Examples
@@ -1794,6 +1800,7 @@ impl Into<Vec<u8>> for String {
 
 #[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
            issue= "27735")]
+#[allow(deprecated)]
 impl IntoCow<'static, str> for String {
     #[inline]
     fn into_cow(self) -> Cow<'static, str> {
@@ -1803,6 +1810,7 @@ impl IntoCow<'static, str> for String {
 
 #[unstable(feature = "into_cow", reason = "may be replaced by `convert::Into`",
            issue = "27735")]
+#[allow(deprecated)]
 impl<'a> IntoCow<'a, str> for &'a str {
     #[inline]
     fn into_cow(self) -> Cow<'a, str> {
diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index fc74d1aed23..a49b7304643 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -73,6 +73,7 @@ use core::ops;
 use core::ptr;
 use core::slice;
 
+#[allow(deprecated)]
 use borrow::{Cow, IntoCow};
 
 use super::range::RangeArgument;
@@ -464,9 +465,7 @@ impl<T> Vec<T> {
     ///
     /// Equivalent to `&s[..]`.
     #[inline]
-    #[unstable(feature = "convert",
-               reason = "waiting on RFC revision",
-               issue = "27729")]
+    #[stable(feature = "vec_as_slice", since = "1.7.0")]
     pub fn as_slice(&self) -> &[T] {
         self
     }
@@ -475,9 +474,7 @@ impl<T> Vec<T> {
     ///
     /// Equivalent to `&mut s[..]`.
     #[inline]
-    #[unstable(feature = "convert",
-               reason = "waiting on RFC revision",
-               issue = "27729")]
+    #[stable(feature = "vec_as_slice", since = "1.7.0")]
     pub fn as_mut_slice(&mut self) -> &mut [T] {
         &mut self[..]
     }
@@ -1516,6 +1513,7 @@ impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
     fn into_cow(self) -> Cow<'a, [T]> {
         Cow::Owned(self)
@@ -1523,6 +1521,7 @@ impl<'a, T: 'a> IntoCow<'a, [T]> for Vec<T> where T: Clone {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<'a, T> IntoCow<'a, [T]> for &'a [T] where T: Clone {
     fn into_cow(self) -> Cow<'a, [T]> {
         Cow::Borrowed(self)
diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs
index 73cb410040c..ba78acc28bc 100644
--- a/src/libcollections/vec_deque.rs
+++ b/src/libcollections/vec_deque.rs
@@ -25,7 +25,6 @@ use core::mem;
 use core::ops::{Index, IndexMut};
 use core::ptr;
 use core::slice;
-use core::usize;
 
 use core::hash::{Hash, Hasher};
 use core::cmp;
@@ -36,7 +35,10 @@ use super::range::RangeArgument;
 
 const INITIAL_CAPACITY: usize = 7; // 2^3 - 1
 const MINIMUM_CAPACITY: usize = 1; // 2 - 1
-const MAXIMUM_ZST_CAPACITY: usize = 1 << (usize::BITS - 1); // Largest possible power of two
+#[cfg(target_pointer_width = "32")]
+const MAXIMUM_ZST_CAPACITY: usize = 1 << (32 - 1); // Largest possible power of two
+#[cfg(target_pointer_width = "64")]
+const MAXIMUM_ZST_CAPACITY: usize = 1 << (64 - 1); // Largest possible power of two
 
 /// `VecDeque` is a growable ring buffer, which can be used as a double-ended
 /// queue efficiently.
diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs
index 0d4c0bb6480..7c986131a52 100644
--- a/src/libcore/fmt/builders.rs
+++ b/src/libcore/fmt/builders.rs
@@ -181,6 +181,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
     /// Returns the wrapped `Formatter`.
     #[unstable(feature = "debug_builder_formatter", reason = "recently added",
                issue = "27782")]
+    #[rustc_deprecated(since = "1.7.0", reason = "will be removed")]
     pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
         &mut self.fmt
     }
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index e2c7579a2b2..37f03d731dc 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -25,10 +25,16 @@ use str;
 use self::rt::v1::Alignment;
 
 #[unstable(feature = "fmt_radix", issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
+#[allow(deprecated)]
 pub use self::num::radix;
 #[unstable(feature = "fmt_radix", issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
+#[allow(deprecated)]
 pub use self::num::Radix;
 #[unstable(feature = "fmt_radix", issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
+#[allow(deprecated)]
 pub use self::num::RadixFmt;
 #[stable(feature = "debug_builders", since = "1.2.0")]
 pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
@@ -1391,7 +1397,7 @@ impl<T> Pointer for *const T {
             f.flags |= 1 << (FlagV1::SignAwareZeroPad as u32);
 
             if let None = f.width {
-                f.width = Some((::usize::BITS/4) + 2);
+                f.width = Some(((mem::size_of::<usize>() * 8) / 4) + 2);
             }
         }
         f.flags |= 1 << (FlagV1::Alternate as u32);
@@ -1532,7 +1538,7 @@ macro_rules! tuple {
     ( $($name:ident,)+ ) => (
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<$($name:Debug),*> Debug for ($($name,)*) {
-            #[allow(non_snake_case, unused_assignments)]
+            #[allow(non_snake_case, unused_assignments, deprecated)]
             fn fmt(&self, f: &mut Formatter) -> Result {
                 let mut builder = f.debug_tuple("");
                 let ($(ref $name,)*) = *self;
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index fa085ec19e6..263e03dcc78 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -10,6 +10,8 @@
 
 //! Integer and floating-point number formatting
 
+#![allow(deprecated)]
+
 // FIXME: #6220 Implement floating point formatting
 
 use prelude::v1::*;
@@ -143,6 +145,7 @@ radix! { UpperHex, 16, "0x", x @  0 ...  9 => b'0' + x,
 #[unstable(feature = "fmt_radix",
            reason = "may be renamed or move to a different module",
            issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
 pub struct Radix {
     base: u8,
 }
@@ -173,6 +176,7 @@ impl GenericRadix for Radix {
 #[unstable(feature = "fmt_radix",
            reason = "may be renamed or move to a different module",
            issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
 #[derive(Copy, Clone)]
 pub struct RadixFmt<T, R>(T, R);
 
@@ -189,6 +193,7 @@ pub struct RadixFmt<T, R>(T, R);
 #[unstable(feature = "fmt_radix",
            reason = "may be renamed or move to a different module",
            issue = "27728")]
+#[rustc_deprecated(since = "1.7.0", reason = "not used enough to stabilize")]
 pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
     RadixFmt(x, Radix::new(base))
 }
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 3cb0691b421..0781dd3b774 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -195,6 +195,7 @@ pub trait Hasher {
 mod impls {
     use prelude::v1::*;
 
+    use mem;
     use slice;
     use super::*;
 
@@ -207,9 +208,7 @@ mod impls {
                 }
 
                 fn hash_slice<H: Hasher>(data: &[$ty], state: &mut H) {
-                    // FIXME(#23542) Replace with type ascription.
-                    #![allow(trivial_casts)]
-                    let newlen = data.len() * ::$ty::BYTES;
+                    let newlen = data.len() * mem::size_of::<$ty>();
                     let ptr = data.as_ptr() as *const u8;
                     state.write(unsafe { slice::from_raw_parts(ptr, newlen) })
                 }
diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs
index 46f3c463ff0..9f7672a52a1 100644
--- a/src/libcore/num/flt2dec/mod.rs
+++ b/src/libcore/num/flt2dec/mod.rs
@@ -210,7 +210,7 @@ impl<'a> Part<'a> {
                     }
                 }
                 Part::Copy(buf) => {
-                    out.clone_from_slice(buf);
+                    out[..buf.len()].clone_from_slice(buf);
                 }
             }
             Some(len)
@@ -245,7 +245,7 @@ impl<'a> Formatted<'a> {
     /// (It may still leave partially written bytes in the buffer; do not rely on that.)
     pub fn write(&self, out: &mut [u8]) -> Option<usize> {
         if out.len() < self.sign.len() { return None; }
-        out.clone_from_slice(self.sign);
+        out[..self.sign.len()].clone_from_slice(self.sign);
 
         let mut written = self.sign.len();
         for part in self.parts {
diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs
index 61dcbdff016..77f662723c8 100644
--- a/src/libcore/num/int_macros.rs
+++ b/src/libcore/num/int_macros.rs
@@ -17,6 +17,8 @@ macro_rules! int_module { ($T:ty, $bits:expr) => (
 #[unstable(feature = "num_bits_bytes",
            reason = "may want to be an associated function",
            issue = "27753")]
+#[rustc_deprecated(since = "1.7.0",
+                   reason = "will be replaced via const fn or associated constants")]
 #[allow(missing_docs)]
 pub const BITS : usize = $bits;
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
@@ -24,6 +26,8 @@ pub const BITS : usize = $bits;
 #[unstable(feature = "num_bits_bytes",
            reason = "may want to be an associated function",
            issue = "27753")]
+#[rustc_deprecated(since = "1.7.0",
+                   reason = "will be replaced via const fn or associated constants")]
 #[allow(missing_docs)]
 pub const BYTES : usize = ($bits / 8);
 
@@ -31,7 +35,7 @@ pub const BYTES : usize = ($bits / 8);
 // calling the `Bounded::min_value` function.
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow(missing_docs)]
-pub const MIN: $T = (-1 as $T) << (BITS - 1);
+pub const MIN: $T = (-1 as $T) << ($bits - 1);
 // FIXME(#9837): Compute MIN like this so the high bits that shouldn't exist are 0.
 // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of
 // calling the `Bounded::max_value` function.
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 76214366dc6..e3e8bcab4f1 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -13,8 +13,6 @@
 #![stable(feature = "rust1", since = "1.0.0")]
 #![allow(missing_docs)]
 
-use self::wrapping::OverflowingOps;
-
 use char::CharExt;
 use cmp::{Eq, PartialOrd};
 use convert::From;
@@ -464,15 +462,13 @@ macro_rules! int_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.checked_rem(2), Some(1));
         /// assert_eq!(5i32.checked_rem(0), None);
         /// assert_eq!(i32::MIN.checked_rem(-1), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_rem(self, other: Self) -> Option<Self> {
             if other == 0 {
@@ -491,14 +487,12 @@ macro_rules! int_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.checked_neg(), Some(-5));
         /// assert_eq!(i32::MIN.checked_neg(), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_neg(self) -> Option<Self> {
             let (a, b) = self.overflowing_neg();
@@ -513,12 +507,10 @@ macro_rules! int_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10i32.checked_shl(4), Some(0x100));
         /// assert_eq!(0x10i32.checked_shl(33), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_shl(self, rhs: u32) -> Option<Self> {
             let (a, b) = self.overflowing_shl(rhs);
@@ -533,12 +525,10 @@ macro_rules! int_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10i32.checked_shr(4), Some(0x1));
         /// assert_eq!(0x10i32.checked_shr(33), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_shr(self, rhs: u32) -> Option<Self> {
             let (a, b) = self.overflowing_shr(rhs);
@@ -595,15 +585,13 @@ macro_rules! int_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(100i32.saturating_mul(127), 12700);
         /// assert_eq!((1i32 << 23).saturating_mul(1 << 23), i32::MAX);
         /// assert_eq!((-1i32 << 23).saturating_mul(1 << 23), i32::MIN);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn saturating_mul(self, other: Self) -> Self {
             self.checked_mul(other).unwrap_or_else(|| {
@@ -796,15 +784,13 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.overflowing_add(2), (7, false));
         /// assert_eq!(i32::MAX.overflowing_add(1), (i32::MIN, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $add_with_overflow(self as $ActualT,
@@ -824,15 +810,13 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.overflowing_sub(2), (3, false));
         /// assert_eq!(i32::MIN.overflowing_sub(1), (i32::MAX, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $sub_with_overflow(self as $ActualT,
@@ -852,13 +836,11 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(5i32.overflowing_mul(2), (10, false));
         /// assert_eq!(1_000_000_000i32.overflowing_mul(10), (1410065408, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $mul_with_overflow(self as $ActualT,
@@ -882,15 +864,13 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.overflowing_div(2), (2, false));
         /// assert_eq!(i32::MIN.overflowing_div(-1), (i32::MIN, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
             if self == Self::min_value() && rhs == -1 {
                 (self, true)
@@ -914,15 +894,13 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(5i32.overflowing_rem(2), (1, false));
         /// assert_eq!(i32::MIN.overflowing_rem(-1), (0, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
             if self == Self::min_value() && rhs == -1 {
                 (0, true)
@@ -944,15 +922,13 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::i32;
         ///
         /// assert_eq!(2i32.overflowing_neg(), (-2, false));
         /// assert_eq!(i32::MIN.overflowing_neg(), (i32::MIN, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_neg(self) -> (Self, bool) {
             if self == Self::min_value() {
                 (Self::min_value(), true)
@@ -974,13 +950,11 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10i32.overflowing_shl(4), (0x100, false));
         /// assert_eq!(0x10i32.overflowing_shl(36), (0x100, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
             (self << (rhs & ($BITS - 1)), (rhs > ($BITS - 1)))
         }
@@ -998,13 +972,11 @@ macro_rules! int_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10i32.overflowing_shr(4), (0x1, false));
         /// assert_eq!(0x10i32.overflowing_shr(36), (0x1, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
             (self >> (rhs & ($BITS - 1)), (rhs > ($BITS - 1)))
         }
@@ -1542,12 +1514,10 @@ macro_rules! uint_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(5u32.checked_rem(2), Some(1));
         /// assert_eq!(5u32.checked_rem(0), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_rem(self, other: Self) -> Option<Self> {
             if other == 0 {
@@ -1557,6 +1527,26 @@ macro_rules! uint_impl {
             }
         }
 
+        /// Checked negation. Computes `-self`, returning `None` unless `self ==
+        /// 0`.
+        ///
+        /// Note that negating any positive integer will overflow.
+        ///
+        /// # Examples
+        ///
+        /// Basic usage:
+        ///
+        /// ```
+        /// assert_eq!(0u32.checked_neg(), Some(0));
+        /// assert_eq!(1u32.checked_neg(), None);
+        /// ```
+        #[stable(feature = "wrapping", since = "1.7.0")]
+        #[inline]
+        pub fn checked_neg(self) -> Option<Self> {
+            let (a, b) = self.overflowing_neg();
+            if b {None} else {Some(a)}
+        }
+
         /// Checked shift left. Computes `self << rhs`, returning `None`
         /// if `rhs` is larger than or equal to the number of bits in `self`.
         ///
@@ -1565,12 +1555,10 @@ macro_rules! uint_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10u32.checked_shl(4), Some(0x100));
         /// assert_eq!(0x10u32.checked_shl(33), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_shl(self, rhs: u32) -> Option<Self> {
             let (a, b) = self.overflowing_shl(rhs);
@@ -1585,12 +1573,10 @@ macro_rules! uint_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10u32.checked_shr(4), Some(0x1));
         /// assert_eq!(0x10u32.checked_shr(33), None);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn checked_shr(self, rhs: u32) -> Option<Self> {
             let (a, b) = self.overflowing_shr(rhs);
@@ -1647,14 +1633,12 @@ macro_rules! uint_impl {
         /// Basic usage:
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::u32;
         ///
         /// assert_eq!(100u32.saturating_mul(127), 12700);
         /// assert_eq!((1u32 << 23).saturating_mul(1 << 23), u32::MAX);
         /// ```
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         #[inline]
         pub fn saturating_mul(self, other: Self) -> Self {
             self.checked_mul(other).unwrap_or(Self::max_value())
@@ -1833,15 +1817,13 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::u32;
         ///
         /// assert_eq!(5u32.overflowing_add(2), (7, false));
         /// assert_eq!(u32::MAX.overflowing_add(1), (0, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_add(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $add_with_overflow(self as $ActualT,
@@ -1861,15 +1843,13 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// use std::u32;
         ///
         /// assert_eq!(5u32.overflowing_sub(2), (3, false));
         /// assert_eq!(0u32.overflowing_sub(1), (u32::MAX, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_sub(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $sub_with_overflow(self as $ActualT,
@@ -1889,13 +1869,11 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(5u32.overflowing_mul(2), (10, false));
         /// assert_eq!(1_000_000_000u32.overflowing_mul(10), (1410065408, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_mul(self, rhs: Self) -> (Self, bool) {
             unsafe {
                 let (a, b) = $mul_with_overflow(self as $ActualT,
@@ -1920,12 +1898,10 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(5u32.overflowing_div(2), (2, false));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_div(self, rhs: Self) -> (Self, bool) {
             (self / rhs, false)
         }
@@ -1946,12 +1922,10 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(5u32.overflowing_rem(2), (1, false));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
             (self % rhs, false)
         }
@@ -1968,13 +1942,11 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0u32.overflowing_neg(), (0, false));
         /// assert_eq!(2u32.overflowing_neg(), (-2i32 as u32, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_neg(self) -> (Self, bool) {
             ((!self).wrapping_add(1), self != 0)
         }
@@ -1992,13 +1964,11 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10u32.overflowing_shl(4), (0x100, false));
         /// assert_eq!(0x10u32.overflowing_shl(36), (0x100, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_shl(self, rhs: u32) -> (Self, bool) {
             (self << (rhs & ($BITS - 1)), (rhs > ($BITS - 1)))
         }
@@ -2016,13 +1986,11 @@ macro_rules! uint_impl {
         /// Basic usage
         ///
         /// ```
-        /// #![feature(wrapping)]
-        ///
         /// assert_eq!(0x10u32.overflowing_shr(4), (0x1, false));
         /// assert_eq!(0x10u32.overflowing_shr(36), (0x1, true));
         /// ```
         #[inline]
-        #[unstable(feature = "wrapping", issue = "27755")]
+        #[stable(feature = "wrapping", since = "1.7.0")]
         pub fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
             (self >> (rhs & ($BITS - 1)), (rhs > ($BITS - 1)))
         }
diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs
index 35e1e988f3e..16d84cf81e1 100644
--- a/src/libcore/num/uint_macros.rs
+++ b/src/libcore/num/uint_macros.rs
@@ -15,11 +15,15 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => (
 #[unstable(feature = "num_bits_bytes",
            reason = "may want to be an associated function",
            issue = "27753")]
+#[rustc_deprecated(since = "1.7.0",
+                   reason = "will be replaced via const fn or associated constants")]
 #[allow(missing_docs)]
 pub const BITS : usize = $bits;
 #[unstable(feature = "num_bits_bytes",
            reason = "may want to be an associated function",
            issue = "27753")]
+#[rustc_deprecated(since = "1.7.0",
+                   reason = "will be replaced via const fn or associated constants")]
 #[allow(missing_docs)]
 pub const BYTES : usize = ($bits / 8);
 
diff --git a/src/libcore/num/usize.rs b/src/libcore/num/usize.rs
index 70e790106e1..a6a7be023eb 100644
--- a/src/libcore/num/usize.rs
+++ b/src/libcore/num/usize.rs
@@ -14,4 +14,7 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-uint_module! { usize, isize, ::isize::BITS }
+#[cfg(target_pointer_width = "32")]
+uint_module! { usize, isize, 32 }
+#[cfg(target_pointer_width = "64")]
+uint_module! { usize, isize, 64 }
diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs
index 8f9e38bbdf9..a6b3dc74469 100644
--- a/src/libcore/num/wrapping.rs
+++ b/src/libcore/num/wrapping.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 #![allow(missing_docs)]
-#![unstable(feature = "wrapping", reason = "may be removed or relocated",
+#![unstable(feature = "old_wrapping", reason = "may be removed or relocated",
             issue = "27755")]
 
 use intrinsics::{add_with_overflow, sub_with_overflow, mul_with_overflow};
@@ -20,6 +20,9 @@ use ops::*;
 
 use ::{i8, i16, i32, i64, isize};
 
+#[unstable(feature = "old_wrapping", reason = "may be removed or relocated",
+           issue = "27755")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to inherent methods")]
 pub trait OverflowingOps {
     fn overflowing_add(self, rhs: Self) -> (Self, bool);
     fn overflowing_sub(self, rhs: Self) -> (Self, bool);
@@ -331,6 +334,7 @@ mod shift_max {
 
 macro_rules! signed_overflowing_impl {
     ($($t:ident)*) => ($(
+        #[allow(deprecated)]
         impl OverflowingOps for $t {
             #[inline(always)]
             fn overflowing_add(self, rhs: $t) -> ($t, bool) {
@@ -393,6 +397,7 @@ macro_rules! signed_overflowing_impl {
 
 macro_rules! unsigned_overflowing_impl {
     ($($t:ident)*) => ($(
+        #[allow(deprecated)]
         impl OverflowingOps for $t {
             #[inline(always)]
             fn overflowing_add(self, rhs: $t) -> ($t, bool) {
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 635b296a645..583bb57a4a6 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -49,7 +49,6 @@ use result::Result::{Ok, Err};
 use ptr;
 use mem;
 use marker::{Send, Sync, self};
-use num::wrapping::OverflowingOps;
 use raw::Repr;
 // Avoid conflicts with *both* the Slice trait (buggy) and the `slice::raw` module.
 use raw::Slice as RawSlice;
@@ -151,8 +150,8 @@ pub trait SliceExt {
     #[stable(feature = "core", since = "1.6.0")]
     fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq;
 
-    #[unstable(feature = "clone_from_slice", issue= "27750")]
-    fn clone_from_slice(&mut self, &[Self::Item]) -> usize where Self::Item: Clone;
+    #[stable(feature = "clone_from_slice", since = "1.7.0")]
+    fn clone_from_slice(&mut self, &[Self::Item]) where Self::Item: Clone;
 }
 
 // Use macros to be generic over const/mut
@@ -476,14 +475,12 @@ impl<T> SliceExt for [T] {
     }
 
     #[inline]
-    fn clone_from_slice(&mut self, src: &[T]) -> usize where T: Clone {
-        let min = cmp::min(self.len(), src.len());
-        let dst = &mut self[.. min];
-        let src = &src[.. min];
-        for i in 0..min {
-            dst[i].clone_from(&src[i]);
+    fn clone_from_slice(&mut self, src: &[T]) where T: Clone {
+        assert!(self.len() == src.len(),
+                "destination and source slices have different lengths");
+        for (dst, src) in self.iter_mut().zip(src) {
+            dst.clone_from(src);
         }
-        min
     }
 }
 
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index d85212d25e7..dd111981f0e 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -32,7 +32,6 @@ use option::Option::{self, None, Some};
 use raw::{Repr, Slice};
 use result::Result::{self, Ok, Err};
 use slice::{self, SliceExt};
-use usize;
 
 pub mod pattern;
 
@@ -1160,15 +1159,16 @@ fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
             // Ascii case, try to skip forward quickly.
             // When the pointer is aligned, read 2 words of data per iteration
             // until we find a word containing a non-ascii byte.
-            const BYTES_PER_ITERATION: usize = 2 * usize::BYTES;
+            let usize_bytes = mem::size_of::<usize>();
+            let bytes_per_iteration = 2 * usize_bytes;
             let ptr = v.as_ptr();
-            let align = (ptr as usize + offset) & (usize::BYTES - 1);
+            let align = (ptr as usize + offset) & (usize_bytes - 1);
             if align == 0 {
-                if len >= BYTES_PER_ITERATION {
-                    while offset <= len - BYTES_PER_ITERATION {
+                if len >= bytes_per_iteration {
+                    while offset <= len - bytes_per_iteration {
                         unsafe {
                             let u = *(ptr.offset(offset as isize) as *const usize);
-                            let v = *(ptr.offset((offset + usize::BYTES) as isize) as *const usize);
+                            let v = *(ptr.offset((offset + usize_bytes) as isize) as *const usize);
 
                             // break if there is a nonascii byte
                             let zu = contains_nonascii(u);
@@ -1177,7 +1177,7 @@ fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> {
                                 break;
                             }
                         }
-                        offset += BYTES_PER_ITERATION;
+                        offset += bytes_per_iteration;
                     }
                 }
                 // step from the point where the wordwise loop stopped
diff --git a/src/libcoretest/num/flt2dec/mod.rs b/src/libcoretest/num/flt2dec/mod.rs
index 65b233ee92f..48a5501acb7 100644
--- a/src/libcoretest/num/flt2dec/mod.rs
+++ b/src/libcoretest/num/flt2dec/mod.rs
@@ -100,7 +100,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
 
     // check significant digits
     for i in 1..cut.unwrap_or(expected.len() - 1) {
-        expected_.clone_from_slice(&expected[..i]);
+        expected_[..i].clone_from_slice(&expected[..i]);
         let mut expectedk_ = expectedk;
         if expected[i] >= b'5' {
             // check if this is a rounding-to-even case.
@@ -147,7 +147,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
     // check infinite zero digits
     if let Some(cut) = cut {
         for i in cut..expected.len()-1 {
-            expected_.clone_from_slice(&expected[..cut]);
+            expected_[..cut].clone_from_slice(&expected[..cut]);
             for c in &mut expected_[cut..i] { *c = b'0'; }
 
             try_exact!(f(&decoded) => &mut buf, &expected_[..i], expectedk;
diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs
index b9fd5cc1910..38b45ec0fea 100644
--- a/src/libgraphviz/lib.rs
+++ b/src/libgraphviz/lib.rs
@@ -47,9 +47,9 @@
 //! which is cyclic.
 //!
 //! ```rust
-//! #![feature(rustc_private, into_cow)]
+//! #![feature(rustc_private)]
 //!
-//! use std::borrow::IntoCow;
+//! use graphviz::IntoCow;
 //! use std::io::Write;
 //! use graphviz as dot;
 //!
@@ -281,12 +281,11 @@
        html_root_url = "https://doc.rust-lang.org/nightly/",
        test(attr(allow(unused_variables), deny(warnings))))]
 
-#![feature(into_cow)]
 #![feature(str_escape)]
 
 use self::LabelText::*;
 
-use std::borrow::{IntoCow, Cow};
+use std::borrow::{Cow, ToOwned};
 use std::io::prelude::*;
 use std::io;
 
@@ -719,6 +718,34 @@ pub fn render_opts<'a,
     writeln(w, &["}"])
 }
 
+pub trait IntoCow<'a, B: ?Sized> where B: ToOwned {
+    fn into_cow(self) -> Cow<'a, B>;
+}
+
+impl<'a> IntoCow<'a, str> for String {
+    fn into_cow(self) -> Cow<'a, str> {
+        Cow::Owned(self)
+    }
+}
+
+impl<'a> IntoCow<'a, str> for &'a str {
+    fn into_cow(self) -> Cow<'a, str> {
+        Cow::Borrowed(self)
+    }
+}
+
+impl<'a, T: Clone> IntoCow<'a, [T]> for Vec<T> {
+    fn into_cow(self) -> Cow<'a, [T]> {
+        Cow::Owned(self)
+    }
+}
+
+impl<'a, T: Clone> IntoCow<'a, [T]> for &'a [T] {
+    fn into_cow(self) -> Cow<'a, [T]> {
+        Cow::Borrowed(self)
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use self::NodeLabels::*;
@@ -726,7 +753,7 @@ mod tests {
     use super::LabelText::{self, LabelStr, EscStr, HtmlStr};
     use std::io;
     use std::io::prelude::*;
-    use std::borrow::IntoCow;
+    use IntoCow;
 
     /// each node is an index in a vector in the graph.
     type Node = usize;
diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs
index f3a1bbd7e26..fe15f1c53f9 100644
--- a/src/librbml/lib.rs
+++ b/src/librbml/lib.rs
@@ -123,7 +123,6 @@
 
 #![feature(rustc_private)]
 #![feature(staged_api)]
-#![feature(clone_from_slice)]
 
 #![cfg_attr(test, feature(test))]
 
@@ -972,7 +971,7 @@ pub mod writer {
                 {
                     let last_size_pos = last_size_pos as usize;
                     let data = &self.writer.get_ref()[last_size_pos+4..cur_pos as usize];
-                    buf.clone_from_slice(data);
+                    buf[..size].clone_from_slice(data);
                 }
 
                 // overwrite the size and data and continue
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 7a047cde0db..501a03f1286 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -26,16 +26,13 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(cell_extras)]
-#![feature(clone_from_slice)]
 #![feature(collections)]
 #![feature(const_fn)]
 #![feature(enumset)]
 #![feature(hashmap_hasher)]
-#![feature(into_cow)]
 #![feature(iter_arith)]
 #![feature(libc)]
 #![feature(nonzero)]
-#![feature(num_bits_bytes)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
@@ -44,7 +41,6 @@
 #![feature(staged_api)]
 #![feature(str_char)]
 #![feature(time2)]
-#![feature(wrapping)]
 #![cfg_attr(test, feature(test))]
 
 #![allow(trivial_casts)]
diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs
index 8fa2dac2da1..e8070925070 100644
--- a/src/librustc/middle/cfg/graphviz.rs
+++ b/src/librustc/middle/cfg/graphviz.rs
@@ -11,10 +11,9 @@
 /// This module provides linkage between rustc::middle::graph and
 /// libgraphviz traits.
 
-use std::borrow::IntoCow;
-
 // For clarity, rename the graphviz crate locally to dot.
 use graphviz as dot;
+use graphviz::IntoCow;
 
 use syntax::ast;
 
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index ab421b27c08..55c9111325d 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -26,6 +26,7 @@ use middle::astconv_util::ast_ty_to_prim_ty;
 use util::num::ToPrimitive;
 use util::nodemap::NodeMap;
 
+use graphviz::IntoCow;
 use syntax::{ast, abi};
 use rustc_front::hir::Expr;
 use rustc_front::hir;
@@ -35,8 +36,7 @@ use syntax::parse::token::InternedString;
 use syntax::ptr::P;
 use syntax::codemap;
 
-use std::borrow::{Cow, IntoCow};
-use std::num::wrapping::OverflowingOps;
+use std::borrow::Cow;
 use std::cmp::Ordering;
 use std::collections::hash_map::Entry::Vacant;
 use std::hash;
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
index 72013c533da..e9029958880 100644
--- a/src/librustc/middle/dataflow.rs
+++ b/src/librustc/middle/dataflow.rs
@@ -18,6 +18,7 @@ use middle::cfg;
 use middle::cfg::CFGIndex;
 use middle::ty;
 use std::io;
+use std::mem;
 use std::usize;
 use syntax::ast;
 use syntax::ast_util::IdRange;
@@ -229,7 +230,8 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
                oper: O,
                id_range: IdRange,
                bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
-        let words_per_id = (bits_per_id + usize::BITS - 1) / usize::BITS;
+        let usize_bits = mem::size_of::<usize>() * 8;
+        let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits;
         let num_nodes = cfg.graph.all_nodes().len();
 
         debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
@@ -408,10 +410,11 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
         //! Returns false on the first call to `f` that returns false;
         //! if all calls to `f` return true, then returns true.
 
+        let usize_bits = mem::size_of::<usize>() * 8;
         for (word_index, &word) in words.iter().enumerate() {
             if word != 0 {
-                let base_index = word_index * usize::BITS;
-                for offset in 0..usize::BITS {
+                let base_index = word_index * usize_bits;
+                for offset in 0..usize_bits {
                     let bit = 1 << offset;
                     if (word & bit) != 0 {
                         // NB: we round up the total number of bits
@@ -618,7 +621,7 @@ fn bits_to_string(words: &[usize]) -> String {
 
     for &word in words {
         let mut v = word;
-        for _ in 0..usize::BYTES {
+        for _ in 0..mem::size_of::<usize>() {
             result.push(sep);
             result.push_str(&format!("{:02x}", v & 0xFF));
             v >>= 8;
@@ -647,8 +650,9 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
 fn set_bit(words: &mut [usize], bit: usize) -> bool {
     debug!("set_bit: words={} bit={}",
            mut_bits_to_string(words), bit_str(bit));
-    let word = bit / usize::BITS;
-    let bit_in_word = bit % usize::BITS;
+    let usize_bits = mem::size_of::<usize>() * 8;
+    let word = bit / usize_bits;
+    let bit_in_word = bit % usize_bits;
     let bit_mask = 1 << bit_in_word;
     debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, word);
     let oldv = words[word];
diff --git a/src/librustc/mir/repr.rs b/src/librustc/mir/repr.rs
index 1b0dfc73229..8496f606b7b 100644
--- a/src/librustc/mir/repr.rs
+++ b/src/librustc/mir/repr.rs
@@ -17,8 +17,9 @@ use rustc_data_structures::tuple_slice::TupleSlice;
 use rustc_front::hir::InlineAsm;
 use syntax::ast::{self, Name};
 use syntax::codemap::Span;
+use graphviz::IntoCow;
 use std::ascii;
-use std::borrow::{Cow, IntoCow};
+use std::borrow::Cow;
 use std::fmt::{self, Debug, Formatter, Write};
 use std::{iter, u32};
 use std::ops::{Index, IndexMut};
diff --git a/src/librustc_back/lib.rs b/src/librustc_back/lib.rs
index 844f4925bd2..746d3ba07d6 100644
--- a/src/librustc_back/lib.rs
+++ b/src/librustc_back/lib.rs
@@ -33,7 +33,6 @@
 #![feature(libc)]
 #![feature(rand)]
 #![feature(rustc_private)]
-#![feature(clone_from_slice)]
 #![feature(staged_api)]
 #![feature(step_by)]
 #![cfg_attr(test, feature(test, rand))]
diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs
index be963f30dc1..eb63f572649 100644
--- a/src/librustc_borrowck/graphviz.rs
+++ b/src/librustc_borrowck/graphviz.rs
@@ -23,7 +23,7 @@ use dot;
 use rustc::middle::cfg::CFGIndex;
 use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
 use std::rc::Rc;
-use std::borrow::IntoCow;
+use dot::IntoCow;
 
 #[derive(Debug, Copy, Clone)]
 pub enum Variant {
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index 0e1102bd77e..d730b383a80 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -22,7 +22,6 @@
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
-#![feature(into_cow)]
 
 #[macro_use] extern crate log;
 #[macro_use] extern crate syntax;
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index e0ed20d31ff..78252c491ec 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -30,7 +30,6 @@
 #![cfg_attr(test, feature(test))]
 #![feature(box_patterns)]
 #![feature(box_syntax)]
-#![feature(num_bits_bytes)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index 891c1aebcdf..c3dfca44349 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -275,20 +275,20 @@ impl LateLintPass for TypeLimits {
         fn int_ty_bits(int_ty: ast::IntTy, target_int_ty: ast::IntTy) -> u64 {
             match int_ty {
                 ast::TyIs => int_ty_bits(target_int_ty, target_int_ty),
-                ast::TyI8 =>    i8::BITS  as u64,
-                ast::TyI16 =>   i16::BITS as u64,
-                ast::TyI32 =>   i32::BITS as u64,
-                ast::TyI64 =>   i64::BITS as u64
+                ast::TyI8 => 8,
+                ast::TyI16 => 16 as u64,
+                ast::TyI32 => 32,
+                ast::TyI64 => 64,
             }
         }
 
         fn uint_ty_bits(uint_ty: ast::UintTy, target_uint_ty: ast::UintTy) -> u64 {
             match uint_ty {
                 ast::TyUs => uint_ty_bits(target_uint_ty, target_uint_ty),
-                ast::TyU8 =>    u8::BITS  as u64,
-                ast::TyU16 =>   u16::BITS as u64,
-                ast::TyU32 =>   u32::BITS as u64,
-                ast::TyU64 =>   u64::BITS as u64
+                ast::TyU8 => 8,
+                ast::TyU16 => 16,
+                ast::TyU32 => 32,
+                ast::TyU64 => 64,
             }
         }
 
diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs
index 0892cf1b5d3..c1ab0284ade 100644
--- a/src/librustc_trans/lib.rs
+++ b/src/librustc_trans/lib.rs
@@ -27,10 +27,8 @@
 #![feature(const_fn)]
 #![feature(custom_attribute)]
 #![allow(unused_attributes)]
-#![feature(into_cow)]
 #![feature(iter_arith)]
 #![feature(libc)]
-#![feature(path_relative_from)]
 #![feature(quote)]
 #![feature(rustc_diagnostic_macros)]
 #![feature(rustc_private)]
diff --git a/src/librustc_trans/trans/assert_dep_graph.rs b/src/librustc_trans/trans/assert_dep_graph.rs
index 924700f0ae5..3d6a6a8fa77 100644
--- a/src/librustc_trans/trans/assert_dep_graph.rs
+++ b/src/librustc_trans/trans/assert_dep_graph.rs
@@ -45,7 +45,7 @@ use rustc_data_structures::fnv::{FnvHashMap, FnvHashSet};
 use rustc_data_structures::graph::{Direction, INCOMING, OUTGOING, NodeIndex};
 use rustc_front::hir;
 use rustc_front::intravisit::Visitor;
-use std::borrow::IntoCow;
+use graphviz::IntoCow;
 use std::env;
 use std::fs::File;
 use std::io::Write;
diff --git a/src/librustc_trans/trans/debuginfo/metadata.rs b/src/librustc_trans/trans/debuginfo/metadata.rs
index d90acd78147..2e3f4326b87 100644
--- a/src/librustc_trans/trans/debuginfo/metadata.rs
+++ b/src/librustc_trans/trans/debuginfo/metadata.rs
@@ -990,8 +990,8 @@ pub fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
                 cx.sess().warn("debuginfo: Invalid path to crate's local root source file!");
                 fallback_path(cx)
             } else {
-                match abs_path.relative_from(work_dir) {
-                    Some(ref p) if p.is_relative() => {
+                match abs_path.strip_prefix(work_dir) {
+                    Ok(ref p) if p.is_relative() => {
                         if p.starts_with(Path::new("./")) {
                             path2cstr(p)
                         } else {
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 8bc1c184d20..850045382e1 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -819,7 +819,7 @@ fn clean_srcpath<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F) wh
     F: FnMut(&str),
 {
     // make it relative, if possible
-    let p = p.relative_from(src_root).unwrap_or(p);
+    let p = p.strip_prefix(src_root).unwrap_or(p);
 
     let mut iter = p.iter().map(|x| x.to_str().unwrap()).peekable();
     while let Some(c) = iter.next() {
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index dce537fe9d2..ac5b64f37aa 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -21,7 +21,6 @@
 #![feature(box_syntax)]
 #![feature(dynamic_lib)]
 #![feature(libc)]
-#![feature(path_relative_from)]
 #![feature(rustc_private)]
 #![feature(set_stdio)]
 #![feature(slice_patterns)]
diff --git a/src/libserialize/collection_impls.rs b/src/libserialize/collection_impls.rs
index cb949940b6d..e21307cc752 100644
--- a/src/libserialize/collection_impls.rs
+++ b/src/libserialize/collection_impls.rs
@@ -10,10 +10,9 @@
 
 //! Implementations of serialization for structures found in libcollections
 
-use std::usize;
-use std::default::Default;
 use std::hash::Hash;
 use std::collections::hash_state::HashState;
+use std::mem;
 
 use {Decodable, Encodable, Decoder, Encoder};
 use std::collections::{LinkedList, VecDeque, BTreeMap, BTreeSet, HashMap, HashSet};
@@ -148,7 +147,7 @@ impl<
     fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> {
         let bits = try!(d.read_uint());
         let mut set = EnumSet::new();
-        for bit in 0..usize::BITS {
+        for bit in 0..(mem::size_of::<usize>()*8) {
             if bits & (1 << bit) != 0 {
                 set.insert(CLike::from_usize(1 << bit));
             }
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index 2941f6f8a02..910600d91e4 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -30,7 +30,6 @@ Core encoding and decoding interfaces.
 #![feature(collections)]
 #![feature(enumset)]
 #![feature(hashmap_hasher)]
-#![feature(num_bits_bytes)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 #![feature(str_char)]
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index 097968cd5a3..f8550fd8842 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -15,7 +15,6 @@ use hash::{Hash, Hasher};
 use marker;
 use mem::{align_of, size_of};
 use mem;
-use num::wrapping::OverflowingOps;
 use ops::{Deref, DerefMut};
 use ptr::{self, Unique};
 use collections::hash_state::HashState;
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index 9a41272299e..d6aa746f4cb 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -150,7 +150,7 @@ pub struct NulError(usize, Vec<u8>);
 /// An error returned from `CString::into_string` to indicate that a UTF-8 error
 /// was encountered during the conversion.
 #[derive(Clone, PartialEq, Debug)]
-#[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+#[stable(feature = "cstring_into", since = "1.7.0")]
 pub struct IntoStringError {
     inner: CString,
     error: Utf8Error,
@@ -235,7 +235,7 @@ impl CString {
     /// Converts the `CString` into a `String` if it contains valid Unicode data.
     ///
     /// On failure, ownership of the original `CString` is returned.
-    #[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+    #[stable(feature = "cstring_into", since = "1.7.0")]
     pub fn into_string(self) -> Result<String, IntoStringError> {
         String::from_utf8(self.into_bytes())
             .map_err(|e| IntoStringError {
@@ -248,9 +248,8 @@ impl CString {
     ///
     /// The returned buffer does **not** contain the trailing nul separator and
     /// it is guaranteed to not have any interior nul bytes.
-    #[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+    #[stable(feature = "cstring_into", since = "1.7.0")]
     pub fn into_bytes(self) -> Vec<u8> {
-        // FIXME: Once this method becomes stable, add an `impl Into<Vec<u8>> for CString`
         let mut vec = self.inner.into_vec();
         let _nul = vec.pop();
         debug_assert_eq!(_nul, Some(0u8));
@@ -259,7 +258,7 @@ impl CString {
 
     /// Equivalent to the `into_bytes` function except that the returned vector
     /// includes the trailing nul byte.
-    #[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+    #[stable(feature = "cstring_into", since = "1.7.0")]
     pub fn into_bytes_with_nul(self) -> Vec<u8> {
         self.inner.into_vec()
     }
@@ -297,6 +296,13 @@ impl fmt::Debug for CString {
     }
 }
 
+#[stable(feature = "cstring_into", since = "1.7.0")]
+impl From<CString> for Vec<u8> {
+    fn from(s: CString) -> Vec<u8> {
+        s.into_bytes()
+    }
+}
+
 #[stable(feature = "cstr_debug", since = "1.3.0")]
 impl fmt::Debug for CStr {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -348,29 +354,33 @@ impl From<NulError> for io::Error {
 impl IntoStringError {
     /// Consumes this error, returning original `CString` which generated the
     /// error.
-    #[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+    #[stable(feature = "cstring_into", since = "1.7.0")]
     pub fn into_cstring(self) -> CString {
         self.inner
     }
 
     /// Access the underlying UTF-8 error that was the cause of this error.
-    #[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+    #[stable(feature = "cstring_into", since = "1.7.0")]
     pub fn utf8_error(&self) -> Utf8Error {
         self.error
     }
 }
 
-#[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+#[stable(feature = "cstring_into", since = "1.7.0")]
 impl Error for IntoStringError {
     fn description(&self) -> &str {
-        Error::description(&self.error)
+        "C string contained non-utf8 bytes"
+    }
+
+    fn cause(&self) -> Option<&Error> {
+        Some(&self.error)
     }
 }
 
-#[unstable(feature = "cstring_into", reason = "recently added", issue = "29157")]
+#[stable(feature = "cstring_into", since = "1.7.0")]
 impl fmt::Display for IntoStringError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        fmt::Display::fmt(&self.error, f)
+        self.description().fmt(f)
     }
 }
 
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs
index de09451e7c0..4573f465819 100644
--- a/src/libstd/io/cursor.rs
+++ b/src/libstd/io/cursor.rs
@@ -252,10 +252,13 @@ impl Write for Cursor<Vec<u8>> {
 
         // Figure out what bytes will be used to overwrite what's currently
         // there (left), and what will be appended on the end (right)
-        let space = self.inner.len() - pos as usize;
-        let (left, right) = buf.split_at(cmp::min(space, buf.len()));
-        self.inner[(pos as usize)..].clone_from_slice(left);
-        self.inner.extend_from_slice(right);
+        {
+            let pos = pos as usize;
+            let space = self.inner.len() - pos;
+            let (left, right) = buf.split_at(cmp::min(space, buf.len()));
+            self.inner[pos..pos + left.len()].clone_from_slice(left);
+            self.inner.extend_from_slice(right);
+        }
 
         // Bump us forward
         self.set_position(pos + buf.len() as u64);
diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs
index 95f630c9658..592e16b0a3c 100644
--- a/src/libstd/io/impls.rs
+++ b/src/libstd/io/impls.rs
@@ -156,7 +156,7 @@ impl<'a> Read for &'a [u8] {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         let amt = cmp::min(buf.len(), self.len());
         let (a, b) = self.split_at(amt);
-        buf.clone_from_slice(a);
+        buf[..amt].clone_from_slice(a);
         *self = b;
         Ok(amt)
     }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 824acda522f..9adea351e3d 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -219,7 +219,6 @@
 #![feature(cfg_target_vendor)]
 #![feature(cfg_target_thread_local)]
 #![feature(char_internals)]
-#![feature(clone_from_slice)]
 #![feature(collections)]
 #![feature(collections_bound)]
 #![feature(const_fn)]
@@ -240,6 +239,7 @@
 #![feature(linkage)]
 #![feature(macro_reexport)]
 #![feature(num_bits_bytes)]
+#![feature(old_wrapping)]
 #![feature(on_unimplemented)]
 #![feature(oom)]
 #![feature(optin_builtin_traits)]
@@ -266,7 +266,6 @@
 #![feature(unsafe_no_drop_flag, filling_drop)]
 #![feature(unwind_attributes)]
 #![feature(vec_push_all)]
-#![feature(wrapping)]
 #![feature(zero_one)]
 
 // Don't link to std. We are std.
diff --git a/src/libstd/memchr.rs b/src/libstd/memchr.rs
index c654efd499b..c043b41ed21 100644
--- a/src/libstd/memchr.rs
+++ b/src/libstd/memchr.rs
@@ -107,7 +107,7 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize> {
 #[allow(dead_code)]
 mod fallback {
     use cmp;
-    use usize;
+    use mem;
 
     const LO_U64: u64 = 0x0101010101010101;
     const HI_U64: u64 = 0x8080808080808080;
@@ -155,12 +155,13 @@ mod fallback {
         // - the last remaining part, < 2 word size
         let len = text.len();
         let ptr = text.as_ptr();
+        let usize_bytes = mem::size_of::<usize>();
 
         // search up to an aligned boundary
-        let align = (ptr as usize) & (usize::BYTES- 1);
+        let align = (ptr as usize) & (usize_bytes- 1);
         let mut offset;
         if align > 0 {
-            offset = cmp::min(usize::BYTES - align, len);
+            offset = cmp::min(usize_bytes - align, len);
             if let Some(index) = text[..offset].iter().position(|elt| *elt == x) {
                 return Some(index);
             }
@@ -171,11 +172,11 @@ mod fallback {
         // search the body of the text
         let repeated_x = repeat_byte(x);
 
-        if len >= 2 * usize::BYTES {
-            while offset <= len - 2 * usize::BYTES {
+        if len >= 2 * usize_bytes {
+            while offset <= len - 2 * usize_bytes {
                 unsafe {
                     let u = *(ptr.offset(offset as isize) as *const usize);
-                    let v = *(ptr.offset((offset + usize::BYTES) as isize) as *const usize);
+                    let v = *(ptr.offset((offset + usize_bytes) as isize) as *const usize);
 
                     // break if there is a matching byte
                     let zu = contains_zero_byte(u ^ repeated_x);
@@ -184,7 +185,7 @@ mod fallback {
                         break;
                     }
                 }
-                offset += usize::BYTES * 2;
+                offset += usize_bytes * 2;
             }
         }
 
@@ -202,12 +203,13 @@ mod fallback {
         // - the first remaining bytes, < 2 word size
         let len = text.len();
         let ptr = text.as_ptr();
+        let usize_bytes = mem::size_of::<usize>();
 
         // search to an aligned boundary
-        let end_align = (ptr as usize + len) & (usize::BYTES - 1);
+        let end_align = (ptr as usize + len) & (usize_bytes - 1);
         let mut offset;
         if end_align > 0 {
-            offset = len - cmp::min(usize::BYTES - end_align, len);
+            offset = len - cmp::min(usize_bytes - end_align, len);
             if let Some(index) = text[offset..].iter().rposition(|elt| *elt == x) {
                 return Some(offset + index);
             }
@@ -218,10 +220,10 @@ mod fallback {
         // search the body of the text
         let repeated_x = repeat_byte(x);
 
-        while offset >= 2 * usize::BYTES {
+        while offset >= 2 * usize_bytes {
             unsafe {
-                let u = *(ptr.offset(offset as isize - 2 * usize::BYTES as isize) as *const usize);
-                let v = *(ptr.offset(offset as isize - usize::BYTES as isize) as *const usize);
+                let u = *(ptr.offset(offset as isize - 2 * usize_bytes as isize) as *const usize);
+                let v = *(ptr.offset(offset as isize - usize_bytes as isize) as *const usize);
 
                 // break if there is a matching byte
                 let zu = contains_zero_byte(u ^ repeated_x);
@@ -230,7 +232,7 @@ mod fallback {
                     break;
                 }
             }
-            offset -= 2 * usize::BYTES;
+            offset -= 2 * usize_bytes;
         }
 
         // find the byte before the point the body loop stopped
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index 808cf5cc031..341ba98191a 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -89,6 +89,9 @@ impl Ipv4Addr {
     }
 
     /// Returns true if this is a loopback address (127.0.0.0/8).
+    ///
+    /// This property is defined by RFC 6890
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_loopback(&self) -> bool {
         self.octets()[0] == 127
     }
@@ -100,6 +103,7 @@ impl Ipv4Addr {
     ///  - 10.0.0.0/8
     ///  - 172.16.0.0/12
     ///  - 192.168.0.0/16
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_private(&self) -> bool {
         match (self.octets()[0], self.octets()[1]) {
             (10, _) => true,
@@ -110,6 +114,9 @@ impl Ipv4Addr {
     }
 
     /// Returns true if the address is link-local (169.254.0.0/16).
+    ///
+    /// This property is defined by RFC 6890
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_link_local(&self) -> bool {
         self.octets()[0] == 169 && self.octets()[1] == 254
     }
@@ -130,7 +137,9 @@ impl Ipv4Addr {
 
     /// Returns true if this is a multicast address.
     ///
-    /// Multicast addresses have a most significant octet between 224 and 239.
+    /// Multicast addresses have a most significant octet between 224 and 239,
+    /// and is defined by RFC 5771
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_multicast(&self) -> bool {
         self.octets()[0] >= 224 && self.octets()[0] <= 239
     }
@@ -138,6 +147,7 @@ impl Ipv4Addr {
     /// Returns true if this is a broadcast address.
     ///
     /// A broadcast address has all octets set to 255 as defined in RFC 919.
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_broadcast(&self) -> bool {
         self.octets()[0] == 255 && self.octets()[1] == 255 &&
         self.octets()[2] == 255 && self.octets()[3] == 255
@@ -150,6 +160,7 @@ impl Ipv4Addr {
     /// - 192.0.2.0/24 (TEST-NET-1)
     /// - 198.51.100.0/24 (TEST-NET-2)
     /// - 203.0.113.0/24 (TEST-NET-3)
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_documentation(&self) -> bool {
         match(self.octets()[0], self.octets()[1], self.octets()[2], self.octets()[3]) {
             (192, 0, 2, _) => true,
@@ -302,11 +313,17 @@ impl Ipv6Addr {
     }
 
     /// Returns true for the special 'unspecified' address ::.
+    ///
+    /// This property is defined in RFC 6890.
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_unspecified(&self) -> bool {
         self.segments() == [0, 0, 0, 0, 0, 0, 0, 0]
     }
 
     /// Returns true if this is a loopback address (::1).
+    ///
+    /// This property is defined in RFC 6890.
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_loopback(&self) -> bool {
         self.segments() == [0, 0, 0, 0, 0, 0, 0, 1]
     }
@@ -378,7 +395,9 @@ impl Ipv6Addr {
 
     /// Returns true if this is a multicast address.
     ///
-    /// Multicast addresses have the form ff00::/8.
+    /// Multicast addresses have the form ff00::/8, and this property is defined
+    /// by RFC 3956.
+    #[stable(since = "1.7.0", feature = "ip_17")]
     pub fn is_multicast(&self) -> bool {
         (self.segments()[0] & 0xff00) == 0xff00
     }
diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs
index 79a269ff87c..91401c8e4fd 100644
--- a/src/libstd/net/parser.rs
+++ b/src/libstd/net/parser.rs
@@ -193,7 +193,7 @@ impl<'a> Parser<'a> {
         fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> Ipv6Addr {
             assert!(head.len() + tail.len() <= 8);
             let mut gs = [0; 8];
-            gs.clone_from_slice(head);
+            gs[..head.len()].clone_from_slice(head);
             gs[(8 - tail.len()) .. 8].clone_from_slice(tail);
             Ipv6Addr::new(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
         }
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 3956f948eb9..e398a5a28c9 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -100,8 +100,10 @@
 #![stable(feature = "rust1", since = "1.0.0")]
 
 use ascii::*;
+#[allow(deprecated)]
 use borrow::{Borrow, IntoCow, ToOwned, Cow};
 use cmp;
+use error::Error;
 use fmt;
 use fs;
 use hash::{Hash, Hasher};
@@ -1043,6 +1045,7 @@ impl PathBuf {
         self._push(path.as_ref())
     }
 
+    #[allow(deprecated)]
     fn _push(&mut self, path: &Path) {
         // 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);
@@ -1219,6 +1222,7 @@ impl Borrow<Path> for PathBuf {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl IntoCow<'static, Path> for PathBuf {
     fn into_cow(self) -> Cow<'static, Path> {
         Cow::Owned(self)
@@ -1226,6 +1230,7 @@ impl IntoCow<'static, Path> for PathBuf {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 impl<'a> IntoCow<'a, Path> for &'a Path {
     fn into_cow(self) -> Cow<'a, Path> {
         Cow::Borrowed(self)
@@ -1328,6 +1333,12 @@ pub struct Path {
     inner: OsStr,
 }
 
+/// An error returned from the `Path::strip_prefix` method indicating that the
+/// prefix was not found in `self`.
+#[derive(Debug, Clone, PartialEq, Eq)]
+#[stable(since = "1.7.0", feature = "strip_prefix")]
+pub struct StripPrefixError(());
+
 impl Path {
     // The following (private!) function allows construction of a path from a u8
     // slice, which is only safe when it is known to follow the OsStr encoding.
@@ -1447,6 +1458,7 @@ impl Path {
     /// assert!(!Path::new("foo.txt").is_absolute());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
+    #[allow(deprecated)]
     pub fn is_absolute(&self) -> bool {
         self.has_root() && (cfg!(unix) || self.prefix().is_some())
     }
@@ -1473,6 +1485,8 @@ impl Path {
     #[unstable(feature = "path_prefix",
                reason = "uncertain whether to expose this convenience",
                issue = "27722")]
+    #[rustc_deprecated(since = "1.7.0",
+                       reason = "inspect components().next() instead")]
     pub fn prefix(&self) -> Option<Prefix> {
         self.components().prefix
     }
@@ -1561,12 +1575,28 @@ impl Path {
     /// returns false), then `relative_from` returns `None`.
     #[unstable(feature = "path_relative_from", reason = "see #23284",
                issue = "23284")]
+    #[rustc_deprecated(since = "1.7.0", reason = "renamed to strip_prefix")]
     pub fn relative_from<'a, P: ?Sized + AsRef<Path>>(&'a self, base: &'a P) -> Option<&Path> {
-        self._relative_from(base.as_ref())
+        self._strip_prefix(base.as_ref()).ok()
+    }
+
+    /// 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`.
+    #[stable(since = "1.7.0", feature = "path_strip_prefix")]
+    pub fn strip_prefix<'a, P: ?Sized>(&'a self, base: &'a P)
+                                       -> Result<&'a Path, StripPrefixError>
+        where P: AsRef<Path>
+    {
+        self._strip_prefix(base.as_ref())
     }
 
-    fn _relative_from<'a>(&'a self, base: &'a Path) -> Option<&'a Path> {
-        iter_after(self.components(), base.components()).map(|c| c.as_path())
+    fn _strip_prefix<'a>(&'a self, base: &'a Path)
+                         -> Result<&'a Path, StripPrefixError> {
+        iter_after(self.components(), base.components())
+            .map(|c| c.as_path())
+            .ok_or(StripPrefixError(()))
     }
 
     /// Determines whether `base` is a prefix of `self`.
@@ -2015,6 +2045,18 @@ impl_eq!(Cow<'a, Path>, Path);
 impl_eq!(Cow<'a, Path>, &'b Path);
 impl_eq!(Cow<'a, Path>, PathBuf);
 
+#[stable(since = "1.7.0", feature = "strip_prefix")]
+impl fmt::Display for StripPrefixError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.description().fmt(f)
+    }
+}
+
+#[stable(since = "1.7.0", feature = "strip_prefix")]
+impl Error for StripPrefixError {
+    fn description(&self) -> &str { "prefix not found" }
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;
@@ -2105,6 +2147,7 @@ mod tests {
     );
 
     #[test]
+    #[allow(deprecated)]
     fn into_cow() {
         use borrow::{Cow, IntoCow};
 
diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs
index e1b7930b6d8..9c9aa20eff5 100644
--- a/src/libstd/sync/mod.rs
+++ b/src/libstd/sync/mod.rs
@@ -39,6 +39,7 @@ pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard};
 #[stable(feature = "rust1", since = "1.0.0")]
 pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT};
 #[stable(feature = "rust1", since = "1.0.0")]
+#[allow(deprecated)]
 pub use self::semaphore::{Semaphore, SemaphoreGuard};
 
 pub mod mpsc;
diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs
index 891f8775ff2..8f08c840c21 100644
--- a/src/libstd/sync/semaphore.rs
+++ b/src/libstd/sync/semaphore.rs
@@ -12,6 +12,10 @@
             reason = "the interaction between semaphores and the acquisition/release \
                       of resources is currently unclear",
             issue = "27798")]
+#![rustc_deprecated(since = "1.7.0",
+                    reason = "easily confused with system sempahores and not \
+                              used enough to pull its weight")]
+#![allow(deprecated)]
 
 use ops::Drop;
 use sync::{Mutex, Condvar};
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs
index 16e1578296d..8d21ba8f661 100644
--- a/src/libstd/sys/unix/ext/fs.rs
+++ b/src/libstd/sys/unix/ext/fs.rs
@@ -23,42 +23,61 @@ use sys;
 use sys_common::{FromInner, AsInner, AsInnerMut};
 
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const USER_READ: raw::mode_t = 0o400;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const USER_WRITE: raw::mode_t = 0o200;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const USER_EXECUTE: raw::mode_t = 0o100;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const USER_RWX: raw::mode_t = 0o700;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const GROUP_READ: raw::mode_t = 0o040;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const GROUP_WRITE: raw::mode_t = 0o020;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const GROUP_EXECUTE: raw::mode_t = 0o010;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const GROUP_RWX: raw::mode_t = 0o070;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const OTHER_READ: raw::mode_t = 0o004;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const OTHER_WRITE: raw::mode_t = 0o002;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const OTHER_EXECUTE: raw::mode_t = 0o001;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const OTHER_RWX: raw::mode_t = 0o007;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const ALL_READ: raw::mode_t = 0o444;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const ALL_WRITE: raw::mode_t = 0o222;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const ALL_EXECUTE: raw::mode_t = 0o111;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const ALL_RWX: raw::mode_t = 0o777;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const SETUID: raw::mode_t = 0o4000;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const SETGID: raw::mode_t = 0o2000;
 #[unstable(feature = "fs_mode", reason = "recently added API", issue = "27712")]
+#[rustc_deprecated(since = "1.7.0", reason = "moved to the libc crate instead")]
 pub const STICKY_BIT: raw::mode_t = 0o1000;
 
 /// Unix-specific extensions to `Permissions`
diff --git a/src/rustbook/book.rs b/src/rustbook/book.rs
index e14c3346cc1..36a37dba1fa 100644
--- a/src/rustbook/book.rs
+++ b/src/rustbook/book.rs
@@ -126,9 +126,9 @@ pub fn parse_summary(input: &mut Read, src: &Path) -> Result<Book, Vec<String>>
         let title = line[start_bracket + 1..end_bracket].to_string();
         let indent = &line[..star_idx];
 
-        let path_from_root = match src.join(given_path).relative_from(src) {
-            Some(p) => p.to_path_buf(),
-            None => {
+        let path_from_root = match src.join(given_path).strip_prefix(src) {
+            Ok(p) => p.to_path_buf(),
+            Err(..) => {
                 errors.push(format!("paths in SUMMARY.md must be relative, \
                                      but path '{}' for section '{}' is not.",
                                      given_path, title));
diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs
index d23e868eead..e8345dc9586 100644
--- a/src/rustbook/main.rs
+++ b/src/rustbook/main.rs
@@ -11,7 +11,6 @@
 #![deny(warnings)]
 
 #![feature(iter_arith)]
-#![feature(path_relative_from)]
 #![feature(rustc_private)]
 #![feature(rustdoc)]
 
diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/compile-fail/lint-exceeding-bitshifts.rs
index ce1406e8010..e1ed21877c9 100644
--- a/src/test/compile-fail/lint-exceeding-bitshifts.rs
+++ b/src/test/compile-fail/lint-exceeding-bitshifts.rs
@@ -11,7 +11,7 @@
 #![deny(exceeding_bitshifts)]
 #![allow(unused_variables)]
 #![allow(dead_code)]
-#![feature(num_bits_bytes, const_indexing)]
+#![feature(const_indexing)]
 
 fn main() {
       let n = 1u8 << 7;
@@ -57,8 +57,13 @@ fn main() {
       let n = 1u8 << (4+3);
       let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
 
-      let n = 1_isize << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
-      let n = 1_usize << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
+      #[cfg(target_pointer_width = "32")]
+      const BITS: usize = 32;
+      #[cfg(target_pointer_width = "64")]
+      const BITS: usize = 64;
+
+      let n = 1_isize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
+      let n = 1_usize << BITS; //~ ERROR: bitshift exceeds the type's number of bits
 
 
       let n = 1i8<<(1isize+-1);
diff --git a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs
index 562cfbe7a14..c729f736115 100644
--- a/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs
+++ b/src/test/run-pass/method-mut-self-modifies-mut-slice-lvalue.rs
@@ -12,9 +12,8 @@
 // type is `&mut [u8]`, passes in a pointer to the lvalue and not a
 // temporary. Issue #19147.
 
-#![feature(clone_from_slice)]
-
 use std::slice;
+use std::cmp;
 
 trait MyWriter {
     fn my_write(&mut self, buf: &[u8]) -> Result<(), ()>;
@@ -22,7 +21,8 @@ trait MyWriter {
 
 impl<'a> MyWriter for &'a mut [u8] {
     fn my_write(&mut self, buf: &[u8]) -> Result<(), ()> {
-        self.clone_from_slice(buf);
+        let amt = cmp::min(self.len(), buf.len());
+        self[..amt].clone_from_slice(&buf[..amt]);
 
         let write_len = buf.len();
         unsafe {