From 995b1591579051fc7f40d1861f847bfe36d96282 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Fri, 13 Feb 2015 00:47:03 +0900 Subject: [PATCH 01/19] rustdoc: Show must_use attribute --- src/librustdoc/html/render.rs | 20 +++++++++++++++++- src/test/run-make/rustdoc-must-use/Makefile | 5 +++++ src/test/run-make/rustdoc-must-use/lib.rs | 23 +++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/test/run-make/rustdoc-must-use/Makefile create mode 100644 src/test/run-make/rustdoc-must-use/lib.rs diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b30b251e8ba6f..95994af7dc8de 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1849,6 +1849,7 @@ fn render_method(w: &mut fmt::Formatter, meth: &clean::Item) -> fmt::Result { fn item_struct(w: &mut fmt::Formatter, it: &clean::Item, s: &clean::Struct) -> fmt::Result { try!(write!(w, "
"));
+    try!(render_attributes(w, it));
     try!(render_struct(w,
                        it,
                        Some(&s.generics),
@@ -1885,7 +1886,9 @@ fn item_struct(w: &mut fmt::Formatter, it: &clean::Item,
 
 fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
              e: &clean::Enum) -> fmt::Result {
-    try!(write!(w, "
{}enum {}{}{}",
+    try!(write!(w, "
"));
+    try!(render_attributes(w, it));
+    try!(write!(w, "{}enum {}{}{}",
                   VisSpace(it.visibility),
                   it.name.as_ref().unwrap(),
                   e.generics,
@@ -1982,6 +1985,21 @@ fn item_enum(w: &mut fmt::Formatter, it: &clean::Item,
     Ok(())
 }
 
+fn render_attributes(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
+    for attr in &it.attrs {
+        match *attr {
+            clean::Word(ref s) if *s == "must_use" => {
+                try!(write!(w, "#[{}]\n", s));
+            }
+            clean::NameValue(ref k, ref v) if *k == "must_use" => {
+                try!(write!(w, "#[{} = \"{}\"]\n", k, v));
+            }
+            _ => ()
+        }
+    }
+    Ok(())
+}
+
 fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
                  g: Option<&clean::Generics>,
                  ty: doctree::StructType,
diff --git a/src/test/run-make/rustdoc-must-use/Makefile b/src/test/run-make/rustdoc-must-use/Makefile
new file mode 100644
index 0000000000000..74fca83f5f915
--- /dev/null
+++ b/src/test/run-make/rustdoc-must-use/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+
+all: lib.rs
+	$(HOST_RPATH_ENV) $(RUSTDOC) -w html -o $(TMPDIR)/doc lib.rs
+	$(HTMLDOCCK) $(TMPDIR)/doc lib.rs
diff --git a/src/test/run-make/rustdoc-must-use/lib.rs b/src/test/run-make/rustdoc-must-use/lib.rs
new file mode 100644
index 0000000000000..cef79d4536bef
--- /dev/null
+++ b/src/test/run-make/rustdoc-must-use/lib.rs
@@ -0,0 +1,23 @@
+// 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  or the MIT license
+// , at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_type="lib"]
+
+// @has lib/struct.Struct.html //pre '#[must_use]'
+#[must_use]
+pub struct Struct {
+    field: i32,
+}
+
+// @has lib/enum.Enum.html //pre '#[must_use = "message"]'
+#[must_use = "message"]
+pub enum Enum {
+    Variant(i32),
+}

From 00a6ff9571bfe3157a4465a992d5d8e0e605a9a3 Mon Sep 17 00:00:00 2001
From: Valerii Hiora 
Date: Thu, 12 Feb 2015 19:15:36 +0200
Subject: [PATCH 02/19] Adjusting default CPUs for iOS

According to @dotdash it enables more aggressive optimizations from LLVM
---
 src/librustc_back/target/apple_ios_base.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/librustc_back/target/apple_ios_base.rs b/src/librustc_back/target/apple_ios_base.rs
index 715bcc4f36dd0..904b337c03f46 100644
--- a/src/librustc_back/target/apple_ios_base.rs
+++ b/src/librustc_back/target/apple_ios_base.rs
@@ -73,8 +73,11 @@ fn pre_link_args(arch: Arch) -> Vec {
 
 fn target_cpu(arch: Arch) -> String {
     match arch {
+        Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher
+        Armv7s => "cortex-a9",
+        Arm64 => "cyclone",
+        I386 => "generic",
         X86_64 => "x86-64",
-        _ => "generic",
     }.to_string()
 }
 

From 985fc7d09b9a3884a8bfa81f739aa15796efc373 Mon Sep 17 00:00:00 2001
From: Alex Crichton 
Date: Wed, 11 Feb 2015 14:18:32 -0800
Subject: [PATCH 03/19] std: Optimize Vec::from_iter

This PR is an optimization of the `FromIterator` implementation of `Vec`

Benchmark: https://gist.github.com/alexcrichton/03d666159a28a80e7c70

Before:
    test macro_repeat1     ... bench:        57 ns/iter (+/- 1)
    test macro_repeat2     ... bench:        56 ns/iter (+/- 1)
    test map_clone1        ... bench:       828 ns/iter (+/- 13)
    test map_clone2        ... bench:       828 ns/iter (+/- 8)
    test repeat1           ... bench:      1104 ns/iter (+/- 10)
    test repeat2           ... bench:      1106 ns/iter (+/- 11)

After:
    test macro_repeat1     ... bench:        75 ns/iter (+/- 21)
    test macro_repeat2     ... bench:        59 ns/iter (+/- 31)
    test map_clone1        ... bench:        34 ns/iter (+/- 22)
    test map_clone2        ... bench:        52 ns/iter (+/- 21)
    test repeat1           ... bench:        34 ns/iter (+/- 11)
    test repeat2           ... bench:        33 ns/iter (+/- 12)

The idea behind this optimization is to avoid all bounds checks for space
already allocated into the vector. This may involve running the iterator twice,
but the first run of the iterator should be optimizable to a memcpy or memset if
possible.

The same treatment can in theory be applied to `Vec::extend` but the benchmarks
for that currently get *worse* if the change is applied. This appears to be some
LLVM optimizations going awry but it's seems prudent to land at least the
`collect` portion beforehand.
---
 src/libcollections/vec.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index 1cd2a89ad604e..7c7d783d129fb 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1380,7 +1380,17 @@ impl FromIterator for Vec {
     fn from_iter>(iterator: I) -> Vec {
         let (lower, _) = iterator.size_hint();
         let mut vector = Vec::with_capacity(lower);
-        for element in iterator {
+
+        let mut i = iterator.fuse();
+        for element in i.by_ref().take(vector.capacity()) {
+            let len = vector.len();
+            unsafe {
+                ptr::write(vector.get_unchecked_mut(len), element);
+                vector.set_len(len + 1);
+            }
+        }
+
+        for element in i {
             vector.push(element)
         }
         vector

From 3df5c4ac21b419c312617212c358d506444da05d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= 
Date: Thu, 12 Feb 2015 21:30:04 +0100
Subject: [PATCH 04/19] Update LLVM to disable asserts in the PassInfo cache

Fixes #22233
---
 src/llvm                             | 2 +-
 src/rustllvm/llvm-auto-clean-trigger | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/llvm b/src/llvm
index 32c27dda3ae23..4891e6382e3e8 160000
--- a/src/llvm
+++ b/src/llvm
@@ -1 +1 @@
-Subproject commit 32c27dda3ae2318b6897f00795009cd6f42ac4b3
+Subproject commit 4891e6382e3e8aa89d530aa18427836428c47157
diff --git a/src/rustllvm/llvm-auto-clean-trigger b/src/rustllvm/llvm-auto-clean-trigger
index cf504b1384812..6bb6f1ad2c7e8 100644
--- a/src/rustllvm/llvm-auto-clean-trigger
+++ b/src/rustllvm/llvm-auto-clean-trigger
@@ -1,4 +1,4 @@
 # If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
 # The actual contents of this file do not matter, but to trigger a change on the
 # build bots then the contents should be changed so git updates the mtime.
-2015-02-09
+2015-02-12

From 9c686dc54dfdad4e517d601fa25270fe0ecd2772 Mon Sep 17 00:00:00 2001
From: Duane Edwards 
Date: Fri, 13 Feb 2015 08:45:52 +1000
Subject: [PATCH 05/19] Correct typo for 'underyling'

---
 src/doc/intro.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/intro.md b/src/doc/intro.md
index 1e343b593df2d..90a018c2dddb8 100644
--- a/src/doc/intro.md
+++ b/src/doc/intro.md
@@ -224,7 +224,7 @@ segfault when we allocate more memory?
 
 The answer is that in the C++ version, `x` is a *reference* to the memory
 location where the first element of the array is stored. But in Ruby, `x` is a
-standalone value, not connected to the underyling array at all. Let's dig into
+standalone value, not connected to the underlying array at all. Let's dig into
 the details for a moment. Your program has access to memory, provided to it by
 the operating system. Each location in memory has an address.  So when we make
 our vector, `v`, it's stored in a memory location somewhere:

From 3d9528a8d8b91a683d76ab1a39cb5b463fa22e42 Mon Sep 17 00:00:00 2001
From: Huon Wilson 
Date: Fri, 13 Feb 2015 14:11:06 +1100
Subject: [PATCH 06/19] Unstabilise `words` for now.

It is not totally clear if we should just use whitespace, or if the full
unicode word-breaking algorithm is more correct. If there is demand we
can reconsider this decision (and consider the precise algorithm to use
in detail).

cc #15628.
---
 src/libcollections/str.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs
index edb6d2de1c850..f78a4b7fefd0b 100644
--- a/src/libcollections/str.rs
+++ b/src/libcollections/str.rs
@@ -1285,7 +1285,8 @@ pub trait StrExt: Index {
     /// let v: Vec<&str> = some_words.words().collect();
     /// assert_eq!(v, vec!["Mary", "had", "a", "little", "lamb"]);
     /// ```
-    #[stable(feature = "rust1", since = "1.0.0")]
+    #[unstable(feature = "str_words",
+               reason = "the precise algorithm to use is unclear")]
     fn words(&self) -> Words {
         UnicodeStr::words(&self[])
     }

From e4a9eb95ce4a457e800571d86942561ada28304a Mon Sep 17 00:00:00 2001
From: Huon Wilson 
Date: Fri, 13 Feb 2015 14:40:57 +1100
Subject: [PATCH 07/19] Remove `_VALUE` from the float extremes constants.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In `std::f32` and `std::f64`:

- `MIN_VALUE` → `MIN`
- `MAX_VALUE` → `MAX`
- `MIN_POS_VALUE` → `MIN_POSITIVE`

This matches the corresponding integer constants.

[breaking-change]
---
 src/libcore/num/f32.rs       | 19 ++++++++++++++++---
 src/libcore/num/f64.rs       | 19 ++++++++++++++++---
 src/libcore/num/mod.rs       | 10 +++++-----
 src/librustc/lint/builtin.rs |  4 ++--
 src/libstd/num/f32.rs        |  1 +
 src/libstd/num/f64.rs        |  1 +
 6 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 83d070feb8a69..b542c9d47f7d4 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -35,14 +35,27 @@ pub const EPSILON: f32 = 1.19209290e-07_f32;
 
 /// Smallest finite f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MIN`")]
 pub const MIN_VALUE: f32 = -3.40282347e+38_f32;
 /// Smallest positive, normalized f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MIN_POSITIVE`")]
 pub const MIN_POS_VALUE: f32 = 1.17549435e-38_f32;
 /// Largest finite f32 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f32::MAX`")]
 pub const MAX_VALUE: f32 = 3.40282347e+38_f32;
 
+/// Smallest finite f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN: f32 = -3.40282347e+38_f32;
+/// Smallest positive, normalized f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN_POSITIVE: f32 = 1.17549435e-38_f32;
+/// Largest finite f32 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MAX: f32 = 3.40282347e+38_f32;
+
 #[unstable(feature = "core", reason = "pending integer conventions")]
 pub const MIN_EXP: int = -125;
 #[unstable(feature = "core", reason = "pending integer conventions")]
@@ -215,17 +228,17 @@ impl Float for f32 {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_value() -> f32 { MIN_VALUE }
+    fn min_value() -> f32 { MIN }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_pos_value(_: Option) -> f32 { MIN_POS_VALUE }
+    fn min_pos_value(_: Option) -> f32 { MIN_POSITIVE }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_value() -> f32 { MAX_VALUE }
+    fn max_value() -> f32 { MAX }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(self) -> (u64, i16, i8) {
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index ce011b3c2eeb6..2aae7107548c6 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -38,14 +38,27 @@ pub const EPSILON: f64 = 2.2204460492503131e-16_f64;
 
 /// Smallest finite f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MIN`")]
 pub const MIN_VALUE: f64 = -1.7976931348623157e+308_f64;
 /// Smallest positive, normalized f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MIN_POSITIVE`")]
 pub const MIN_POS_VALUE: f64 = 2.2250738585072014e-308_f64;
 /// Largest finite f64 value
 #[stable(feature = "rust1", since = "1.0.0")]
+#[deprecated(since = "1.0.0", reason = "use `std::f64::MAX`")]
 pub const MAX_VALUE: f64 = 1.7976931348623157e+308_f64;
 
+/// Smallest finite f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN: f64 = -1.7976931348623157e+308_f64;
+/// Smallest positive, normalized f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MIN_POSITIVE: f64 = 2.2250738585072014e-308_f64;
+/// Largest finite f64 value
+#[stable(feature = "rust1", since = "1.0.0")]
+pub const MAX: f64 = 1.7976931348623157e+308_f64;
+
 #[unstable(feature = "core", reason = "pending integer conventions")]
 pub const MIN_EXP: int = -1021;
 #[unstable(feature = "core", reason = "pending integer conventions")]
@@ -222,17 +235,17 @@ impl Float for f64 {
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_value() -> f64 { MIN_VALUE }
+    fn min_value() -> f64 { MIN }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn min_pos_value(_: Option) -> f64 { MIN_POS_VALUE }
+    fn min_pos_value(_: Option) -> f64 { MIN_POSITIVE }
 
     #[inline]
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0")]
-    fn max_value() -> f64 { MAX_VALUE }
+    fn max_value() -> f64 { MAX }
 
     /// Returns the mantissa, exponent and sign as integers.
     fn integer_decode(self) -> (u64, i16, i8) {
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index b7c5c6640ced0..8aef16c2874ee 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -956,7 +956,7 @@ macro_rules! impl_to_primitive_float_to_float {
             Some($slf as $DstT)
         } else {
             let n = $slf as f64;
-            let max_value: $SrcT = ::$SrcT::MAX_VALUE;
+            let max_value: $SrcT = ::$SrcT::MAX;
             if -max_value as f64 <= n && n <= max_value as f64 {
                 Some($slf as $DstT)
             } else {
@@ -1331,18 +1331,18 @@ pub trait Float
     /// Returns the smallest finite value that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate")]
+                 reason = "use `std::f32::MIN` or `std::f64::MIN` as appropriate")]
     fn min_value() -> Self;
     /// Returns the smallest normalized positive number that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MIN_POS_VALUE` or \
-                           `std::f64::MIN_POS_VALUE` as appropriate")]
+                 reason = "use `std::f32::MIN_POSITIVE` or \
+                           `std::f64::MIN_POSITIVE` as appropriate")]
     fn min_pos_value(unused_self: Option) -> Self;
     /// Returns the largest finite value that this type can represent.
     #[unstable(feature = "core")]
     #[deprecated(since = "1.0.0",
-                 reason = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate")]
+                 reason = "use `std::f32::MAX` or `std::f64::MAX` as appropriate")]
     fn max_value() -> Self;
 
     /// Returns true if this value is NaN and false otherwise.
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index a415ff3ed7165..5aff5b0d3c72d 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -318,8 +318,8 @@ impl LintPass for TypeLimits {
 
         fn float_ty_range(float_ty: ast::FloatTy) -> (f64, f64) {
             match float_ty {
-                ast::TyF32  => (f32::MIN_VALUE as f64, f32::MAX_VALUE as f64),
-                ast::TyF64  => (f64::MIN_VALUE,        f64::MAX_VALUE)
+                ast::TyF32  => (f32::MIN as f64, f32::MAX as f64),
+                ast::TyF64  => (f64::MIN,        f64::MAX)
             }
         }
 
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 58b93665fe153..83a5c68912cf3 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -30,6 +30,7 @@ use core::num;
 pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
 pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
 pub use core::f32::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
+pub use core::f32::{MIN, MIN_POSITIVE, MAX};
 pub use core::f32::consts;
 
 #[allow(dead_code)]
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 8b17feeb70cdc..f243955d199dc 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -29,6 +29,7 @@ use core::num;
 pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
 pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
 pub use core::f64::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
+pub use core::f64::{MIN, MIN_POSITIVE, MAX};
 pub use core::f64::consts;
 
 #[allow(dead_code)]

From c5dba7275a931994040aab4890f59c704c5d0b58 Mon Sep 17 00:00:00 2001
From: Kevin Yap 
Date: Thu, 12 Feb 2015 23:25:36 -0800
Subject: [PATCH 08/19] Remove reference to mailing list

Also add address of IRC server. Addresses #22249.
---
 src/doc/complement-bugreport.md | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/doc/complement-bugreport.md b/src/doc/complement-bugreport.md
index 848c56ee543dd..1a28cd682e70c 100644
--- a/src/doc/complement-bugreport.md
+++ b/src/doc/complement-bugreport.md
@@ -56,8 +56,6 @@ $ RUST_BACKTRACE=1 rustc ...
 
 # I submitted a bug, but nobody has commented on it!
 
-This is sad, but does happen sometimes, since we're short-staffed. If you
-submit a bug and you haven't received a comment on it within 3 business days,
-it's entirely reasonable to either ask on the #rust IRC channel,
-or post on the [rust-dev mailing list](https://mail.mozilla.org/listinfo/rust-dev)
-to ask what the status of the bug is.
+This is sad, but does happen sometimes, since we're short-staffed. If you submit a
+bug and you haven't received a comment on it within 3 business days, it's entirely
+reasonable to ask about the status of the bug in #rust on irc.mozilla.org.

From c6a647af6aa42db4737c16bec2a8cd2db91da443 Mon Sep 17 00:00:00 2001
From: Ruud van Asseldonk 
Date: Fri, 13 Feb 2015 13:50:53 +0100
Subject: [PATCH 09/19] Replace map(|x| *x) with cloned().

This partially resolves #22243.
---
 src/libcollections/bit.rs                | 6 +++---
 src/libcore/iter.rs                      | 2 +-
 src/libcoretest/iter.rs                  | 2 +-
 src/librustc/metadata/cstore.rs          | 2 +-
 src/librustc/middle/check_match.rs       | 2 +-
 src/librustc/middle/const_eval.rs        | 2 +-
 src/librustc/middle/dependency_format.rs | 2 +-
 src/librustc/middle/lang_items.rs        | 2 +-
 src/librustc/middle/region.rs            | 2 +-
 src/librustc/middle/ty.rs                | 2 +-
 src/librustc_typeck/check/mod.rs         | 4 ++--
 src/libstd/env.rs                        | 8 ++++----
 src/libstd/sys/windows/thread_local.rs   | 2 +-
 src/libsyntax/ast_map/mod.rs             | 2 +-
 src/libsyntax/ext/base.rs                | 2 +-
 src/libsyntax/ext/source_util.rs         | 2 +-
 src/libtest/lib.rs                       | 2 +-
 src/test/bench/shootout-fasta.rs         | 2 +-
 src/test/bench/shootout-meteor.rs        | 2 +-
 19 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index 6d15a264172a1..2488973565b9d 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -2282,7 +2282,7 @@ mod tests {
     #[test]
     fn test_from_bools() {
         let bools = vec![true, false, true, true];
-        let bitv: Bitv = bools.iter().map(|n| *n).collect();
+        let bitv: Bitv = bools.iter().cloned().collect();
         assert_eq!(format!("{:?}", bitv), "1011");
     }
 
@@ -2295,12 +2295,12 @@ mod tests {
     #[test]
     fn test_bitv_iterator() {
         let bools = vec![true, false, true, true];
-        let bitv: Bitv = bools.iter().map(|n| *n).collect();
+        let bitv: Bitv = bools.iter().cloned().collect();
 
         assert_eq!(bitv.iter().collect::>(), bools);
 
         let long: Vec<_> = (0i32..10000).map(|i| i % 2 == 0).collect();
-        let bitv: Bitv = long.iter().map(|n| *n).collect();
+        let bitv: Bitv = long.iter().cloned().collect();
         assert_eq!(bitv.iter().collect::>(), long)
     }
 
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 7740cd6867cbd..ac2db815fceb1 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -325,7 +325,7 @@ pub trait IteratorExt: Iterator + Sized {
     ///
     /// ```
     /// let xs = [100, 200, 300];
-    /// let mut it = xs.iter().map(|x| *x).peekable();
+    /// let mut it = xs.iter().cloned().peekable();
     /// assert_eq!(*it.peek().unwrap(), 100);
     /// assert_eq!(it.next().unwrap(), 100);
     /// assert_eq!(it.next().unwrap(), 200);
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs
index 7eb0fb97bed2a..88777da0bcd35 100644
--- a/src/libcoretest/iter.rs
+++ b/src/libcoretest/iter.rs
@@ -713,7 +713,7 @@ fn test_random_access_inspect() {
 fn test_random_access_map() {
     let xs = [1, 2, 3, 4, 5];
 
-    let mut it = xs.iter().map(|x| *x);
+    let mut it = xs.iter().cloned();
     assert_eq!(xs.len(), it.indexable());
     for (i, elt) in xs.iter().enumerate() {
         assert_eq!(Some(*elt), it.idx(i));
diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs
index 0a3e173b35ee5..8673aec552dcb 100644
--- a/src/librustc/metadata/cstore.rs
+++ b/src/librustc/metadata/cstore.rs
@@ -218,7 +218,7 @@ impl CStore {
 
     pub fn find_extern_mod_stmt_cnum(&self, emod_id: ast::NodeId)
                                      -> Option {
-        self.extern_mod_crate_map.borrow().get(&emod_id).map(|x| *x)
+        self.extern_mod_crate_map.borrow().get(&emod_id).cloned()
     }
 }
 
diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs
index 7ac690f02e1b5..ba40798af3f0b 100644
--- a/src/librustc/middle/check_match.rs
+++ b/src/librustc/middle/check_match.rs
@@ -75,7 +75,7 @@ impl<'a> fmt::Debug for Matrix<'a> {
             pretty_printed_matrix.iter().map(|row| row[col].len()).max().unwrap_or(0)
         }).collect();
 
-        let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1;
+        let total_width = column_widths.iter().cloned().sum() + column_count * 3 + 1;
         let br = repeat('+').take(total_width).collect::();
         try!(write!(f, "{}\n", br));
         for row in pretty_printed_matrix {
diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs
index a6a647173faa7..c4e1d9a64bd96 100644
--- a/src/librustc/middle/const_eval.rs
+++ b/src/librustc/middle/const_eval.rs
@@ -600,7 +600,7 @@ pub fn lit_to_const(lit: &ast::Lit) -> const_val {
     match lit.node {
         ast::LitStr(ref s, _) => const_str((*s).clone()),
         ast::LitBinary(ref data) => {
-            const_binary(Rc::new(data.iter().map(|x| *x).collect()))
+            const_binary(Rc::new(data.iter().cloned().collect()))
         }
         ast::LitByte(n) => const_uint(n as u64),
         ast::LitChar(n) => const_uint(n as u64),
diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs
index 6d35a82d153cd..ad9f4eade5c90 100644
--- a/src/librustc/middle/dependency_format.rs
+++ b/src/librustc/middle/dependency_format.rs
@@ -158,7 +158,7 @@ fn calculate_type(sess: &session::Session,
 
     // Collect what we've got so far in the return vector.
     let mut ret = (1..sess.cstore.next_crate_num()).map(|i| {
-        match formats.get(&i).map(|v| *v) {
+        match formats.get(&i).cloned() {
             v @ Some(cstore::RequireDynamic) => v,
             _ => None,
         }
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index ef72c2242c1e7..b9255f75ed613 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -149,7 +149,7 @@ impl<'a, 'v> Visitor<'v> for LanguageItemCollector<'a> {
     fn visit_item(&mut self, item: &ast::Item) {
         match extract(&item.attrs) {
             Some(value) => {
-                let item_index = self.item_refs.get(&value[]).map(|x| *x);
+                let item_index = self.item_refs.get(&value[]).cloned();
 
                 match item_index {
                     Some(item_index) => {
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index 2f0462ab8c338..e539f6ae6cb93 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -407,7 +407,7 @@ impl RegionMaps {
 
     pub fn opt_encl_scope(&self, id: CodeExtent) -> Option {
         //! Returns the narrowest scope that encloses `id`, if any.
-        self.scope_map.borrow().get(&id).map(|x| *x)
+        self.scope_map.borrow().get(&id).cloned()
     }
 
     #[allow(dead_code)] // used in middle::cfg
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 6026359ddace0..2a1dd1ba16e32 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -4944,7 +4944,7 @@ pub fn note_and_explain_type_err(cx: &ctxt, err: &type_err) {
 }
 
 pub fn provided_source(cx: &ctxt, id: ast::DefId) -> Option {
-    cx.provided_method_sources.borrow().get(&id).map(|x| *x)
+    cx.provided_method_sources.borrow().get(&id).cloned()
 }
 
 pub fn provided_trait_methods<'tcx>(cx: &ctxt<'tcx>, id: ast::DefId)
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index d12b23187b80b..5b75e06c88706 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -3223,7 +3223,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
         for field in ast_fields {
             let mut expected_field_type = tcx.types.err;
 
-            let pair = class_field_map.get(&field.ident.node.name).map(|x| *x);
+            let pair = class_field_map.get(&field.ident.node.name).cloned();
             match pair {
                 None => {
                     fcx.type_error_message(
@@ -3871,7 +3871,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
       }
       ast::ExprStruct(ref path, ref fields, ref base_expr) => {
         // Resolve the path.
-        let def = tcx.def_map.borrow().get(&id).map(|i| *i);
+        let def = tcx.def_map.borrow().get(&id).cloned();
         let struct_id = match def {
             Some(def::DefVariant(enum_id, variant_id, true)) => {
                 check_struct_enum_variant(fcx, id, expr.span, enum_id,
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index ea18838211f26..bfc1afc6eb4f2 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -918,7 +918,7 @@ mod tests {
     #[cfg(unix)]
     fn join_paths_unix() {
         fn test_eq(input: &[&str], output: &str) -> bool {
-            &*join_paths(input.iter().map(|s| *s)).unwrap() ==
+            &*join_paths(input.iter().cloned()).unwrap() ==
                 OsStr::from_str(output)
         }
 
@@ -927,14 +927,14 @@ mod tests {
                          "/bin:/usr/bin:/usr/local/bin"));
         assert!(test_eq(&["", "/bin", "", "", "/usr/bin", ""],
                          ":/bin:::/usr/bin:"));
-        assert!(join_paths(["/te:st"].iter().map(|s| *s)).is_err());
+        assert!(join_paths(["/te:st"].iter().cloned()).is_err());
     }
 
     #[test]
     #[cfg(windows)]
     fn join_paths_windows() {
         fn test_eq(input: &[&str], output: &str) -> bool {
-            &*join_paths(input.iter().map(|s| *s)).unwrap() ==
+            &*join_paths(input.iter().cloned()).unwrap() ==
                 OsStr::from_str(output)
         }
 
@@ -945,6 +945,6 @@ mod tests {
                         r";c:\windows;;;c:\;"));
         assert!(test_eq(&[r"c:\te;st", r"c:\"],
                         r#""c:\te;st";c:\"#));
-        assert!(join_paths([r#"c:\te"st"#].iter().map(|s| *s)).is_err());
+        assert!(join_paths([r#"c:\te"st"#].iter().cloned()).is_err());
     }
     }
diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs
index 0c24ab1fa09b4..c11d16df61564 100644
--- a/src/libstd/sys/windows/thread_local.rs
+++ b/src/libstd/sys/windows/thread_local.rs
@@ -244,7 +244,7 @@ unsafe fn run_dtors() {
             let ret = if DTORS.is_null() {
                 Vec::new()
             } else {
-                (*DTORS).iter().map(|s| *s).collect()
+                (*DTORS).iter().cloned().collect()
             };
             DTOR_LOCK.unlock();
             ret
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 5535e5911e0c2..6535705388d01 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -251,7 +251,7 @@ impl<'ast> Map<'ast> {
     }
 
     fn find_entry(&self, id: NodeId) -> Option> {
-        self.map.borrow().get(id as usize).map(|e| *e)
+        self.map.borrow().get(id as usize).cloned()
     }
 
     pub fn krate(&self) -> &'ast Crate {
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 64ae6162ef4e5..26e291a4c693a 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -639,7 +639,7 @@ impl<'a> ExtCtxt<'a> {
     pub fn mod_path(&self) -> Vec {
         let mut v = Vec::new();
         v.push(token::str_to_ident(&self.ecfg.crate_name[]));
-        v.extend(self.mod_path.iter().map(|a| *a));
+        v.extend(self.mod_path.iter().cloned());
         return v;
     }
     pub fn bt_push(&mut self, ei: ExpnInfo) {
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 7a3a3562bdfdc..d1dee115b6bcd 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -179,7 +179,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree])
             return DummyResult::expr(sp);
         }
         Ok(bytes) => {
-            let bytes = bytes.iter().map(|x| *x).collect();
+            let bytes = bytes.iter().cloned().collect();
             base::MacExpr::new(cx.expr_lit(sp, ast::LitBinary(Rc::new(bytes))))
         }
     }
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index cc468df87f383..be22a76a7671a 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -938,7 +938,7 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box>) -> TestR
         (&ShouldFail::Yes(Some(msg)), Err(ref err))
             if err.downcast_ref::()
                 .map(|e| &**e)
-                .or_else(|| err.downcast_ref::<&'static str>().map(|e| *e))
+                .or_else(|| err.downcast_ref::<&'static str>().cloned())
                 .map(|e| e.contains(msg))
                 .unwrap_or(false) => TrOk,
         _ => TrFailed,
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 141e098745e7b..0d28dd481a63b 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -133,7 +133,7 @@ fn run(writer: &mut W) -> std::old_io::IoResult<()> {
                         ('t', 0.3015094502008)];
 
     try!(make_fasta(writer, ">ONE Homo sapiens alu\n",
-                    alu.as_bytes().iter().cycle().map(|c| *c), n * 2));
+                    alu.as_bytes().iter().cycle().cloned(), n * 2));
     try!(make_fasta(writer, ">TWO IUB ambiguity codes\n",
                     AAGen::new(rng, iub), n * 3));
     try!(make_fasta(writer, ">THREE Homo sapiens frequency\n",
diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs
index d061403d5901d..59abd63e12d59 100644
--- a/src/test/bench/shootout-meteor.rs
+++ b/src/test/bench/shootout-meteor.rs
@@ -270,7 +270,7 @@ fn handle_sol(raw_sol: &List, data: &mut Data) {
     // reverse order, i.e. the board rotated by half a turn.
     data.nb += 2;
     let sol1 = to_vec(raw_sol);
-    let sol2: Vec = sol1.iter().rev().map(|x| *x).collect();
+    let sol2: Vec = sol1.iter().rev().cloned().collect();
 
     if data.nb == 2 {
         data.min = sol1.clone();

From 1c7cb8b745bdbd51fe4ba156c159ab4152fd191c Mon Sep 17 00:00:00 2001
From: Ruud van Asseldonk 
Date: Fri, 13 Feb 2015 14:06:31 +0100
Subject: [PATCH 10/19] Relpace map(|x| x.clone()) with cloned().

---
 src/libcollections/dlist.rs                  | 2 +-
 src/librustc/middle/infer/error_reporting.rs | 2 +-
 src/librustc_back/rpath.rs                   | 2 +-
 src/librustc_trans/trans/base.rs             | 2 +-
 src/librustdoc/passes.rs                     | 2 +-
 src/libsyntax/ext/deriving/generic/mod.rs    | 8 ++++----
 src/libsyntax/parse/parser.rs                | 6 +++---
 src/libsyntax/print/pprust.rs                | 2 +-
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index a080146e0ec50..f33d7155a5daf 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -895,7 +895,7 @@ impl Ord for DList {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Clone for DList {
     fn clone(&self) -> DList {
-        self.iter().map(|x| x.clone()).collect()
+        self.iter().cloned().collect()
     }
 }
 
diff --git a/src/librustc/middle/infer/error_reporting.rs b/src/librustc/middle/infer/error_reporting.rs
index 5d7a56ef0e6c6..4bb7f03655fee 100644
--- a/src/librustc/middle/infer/error_reporting.rs
+++ b/src/librustc/middle/infer/error_reporting.rs
@@ -924,7 +924,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
 
     fn rebuild(&self)
                -> (ast::FnDecl, Option, ast::Generics) {
-        let mut expl_self_opt = self.expl_self_opt.map(|x| x.clone());
+        let mut expl_self_opt = self.expl_self_opt.cloned();
         let mut inputs = self.fn_decl.inputs.clone();
         let mut output = self.fn_decl.output.clone();
         let mut ty_params = self.generics.ty_params.clone();
diff --git a/src/librustc_back/rpath.rs b/src/librustc_back/rpath.rs
index 36bbd4b987297..7756f87162e6b 100644
--- a/src/librustc_back/rpath.rs
+++ b/src/librustc_back/rpath.rs
@@ -41,7 +41,7 @@ pub fn get_rpath_flags(config: RPathConfig) -> Vec where
 
     let libs = config.used_crates.clone();
     let libs = libs.into_iter().filter_map(|(_, l)| {
-        l.map(|p| p.clone())
+        l.cloned()
     }).collect::>();
 
     let rpaths = get_rpaths(config, &libs[]);
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index 52ef2b75f9571..6934cd9aa3a93 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -3228,7 +3228,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>)
     reachable.push("rust_eh_personality_catch".to_string());
 
     if codegen_units > 1 {
-        internalize_symbols(&shared_ccx, &reachable.iter().map(|x| x.clone()).collect());
+        internalize_symbols(&shared_ccx, &reachable.iter().cloned().collect());
     }
 
     let metadata_module = ModuleTranslation {
diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs
index abd73fcfb7028..722f14fa6d4c7 100644
--- a/src/librustdoc/passes.rs
+++ b/src/librustdoc/passes.rs
@@ -293,7 +293,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult {
             let mut a: Vec = i.attrs.iter().filter(|&a| match a {
                 &clean::NameValue(ref x, _) if "doc" == *x => false,
                 _ => true
-            }).map(|x| x.clone()).collect();
+            }).cloned().collect();
             if docstr.len() > 0 {
                 a.push(clean::NameValue("doc".to_string(), docstr));
             }
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index d9242417e0475..c7dd41722ff6f 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -367,7 +367,7 @@ impl<'a> TraitDef<'a> {
                 "allow" | "warn" | "deny" | "forbid" => true,
                 _ => false,
             }
-        }).map(|a| a.clone()));
+        }).cloned());
         push(P(ast::Item {
             attrs: attrs,
             ..(*newitem).clone()
@@ -445,14 +445,14 @@ impl<'a> TraitDef<'a> {
                         span: self.span,
                         bound_lifetimes: wb.bound_lifetimes.clone(),
                         bounded_ty: wb.bounded_ty.clone(),
-                        bounds: OwnedSlice::from_vec(wb.bounds.iter().map(|b| b.clone()).collect())
+                        bounds: OwnedSlice::from_vec(wb.bounds.iter().cloned().collect())
                     })
                 }
                 ast::WherePredicate::RegionPredicate(ref rb) => {
                     ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate {
                         span: self.span,
                         lifetime: rb.lifetime,
-                        bounds: rb.bounds.iter().map(|b| b.clone()).collect()
+                        bounds: rb.bounds.iter().cloned().collect()
                     })
                 }
                 ast::WherePredicate::EqPredicate(ref we) => {
@@ -500,7 +500,7 @@ impl<'a> TraitDef<'a> {
         let opt_trait_ref = Some(trait_ref);
         let ident = ast_util::impl_pretty_name(&opt_trait_ref, &*self_type);
         let mut a = vec![attr];
-        a.extend(self.attributes.iter().map(|a| a.clone()));
+        a.extend(self.attributes.iter().cloned());
         cx.item(
             self.span,
             ident,
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index fd2f0685cab83..adbb22786f922 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -241,7 +241,7 @@ macro_rules! maybe_whole {
 fn maybe_append(mut lhs: Vec, rhs: Option>)
                 -> Vec {
     match rhs {
-        Some(ref attrs) => lhs.extend(attrs.iter().map(|a| a.clone())),
+        Some(ref attrs) => lhs.extend(attrs.iter().cloned()),
         None => {}
     }
     lhs
@@ -467,7 +467,7 @@ impl<'a> Parser<'a> {
         debug!("commit_expr {:?}", e);
         if let ExprPath(..) = e.node {
             // might be unit-struct construction; check for recoverableinput error.
-            let mut expected = edible.iter().map(|x| x.clone()).collect::>();
+            let mut expected = edible.iter().cloned().collect::>();
             expected.push_all(inedible);
             self.check_for_erroneous_unit_struct_expecting(&expected[]);
         }
@@ -485,7 +485,7 @@ impl<'a> Parser<'a> {
         if self.last_token
                .as_ref()
                .map_or(false, |t| t.is_ident() || t.is_path()) {
-            let mut expected = edible.iter().map(|x| x.clone()).collect::>();
+            let mut expected = edible.iter().cloned().collect::>();
             expected.push_all(&inedible[]);
             self.check_for_erroneous_unit_struct_expecting(
                 &expected[]);
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 583095e157427..78bfc0b3de706 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -983,7 +983,7 @@ impl<'a> State<'a> {
                 try!(self.word_nbsp("trait"));
                 try!(self.print_ident(item.ident));
                 try!(self.print_generics(generics));
-                let bounds: Vec<_> = bounds.iter().map(|b| b.clone()).collect();
+                let bounds: Vec<_> = bounds.iter().cloned().collect();
                 let mut real_bounds = Vec::with_capacity(bounds.len());
                 for b in bounds {
                     if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = b {

From 539866bef5eadbb6c9e41ce0ba8d488949160e0d Mon Sep 17 00:00:00 2001
From: Ruud van Asseldonk 
Date: Fri, 13 Feb 2015 14:47:59 +0100
Subject: [PATCH 11/19] Replace map(|x| (*x).clone()) with cloned().

This resolves #22243, at least for one-letter variable names.
---
 src/libcollections/dlist.rs               | 2 +-
 src/librustc/middle/resolve_lifetime.rs   | 2 +-
 src/librustc/middle/traits/select.rs      | 2 +-
 src/librustc_trans/trans/expr.rs          | 2 +-
 src/librustc_trans/trans/type_of.rs       | 2 +-
 src/librustdoc/visit_ast.rs               | 2 +-
 src/libsyntax/ext/deriving/generic/mod.rs | 2 +-
 src/libsyntax/ext/tt/macro_parser.rs      | 4 +---
 src/libsyntax/ext/tt/macro_rules.rs       | 2 +-
 src/libsyntax/parse/lexer/comments.rs     | 2 +-
 10 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index f33d7155a5daf..9159e92a21640 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -1013,7 +1013,7 @@ mod tests {
 
     #[cfg(test)]
     fn list_from(v: &[T]) -> DList {
-        v.iter().map(|x| (*x).clone()).collect()
+        v.iter().cloned().collect()
     }
 
     #[test]
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index e91d7d8c52cde..3ba08c1032031 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -562,7 +562,7 @@ pub fn early_bound_lifetimes<'a>(generics: &'a ast::Generics) -> Vec SelectionContext<'cx, 'tcx> {
     {
         let cache = self.pick_candidate_cache();
         let hashmap = cache.hashmap.borrow();
-        hashmap.get(&cache_fresh_trait_pred.0.trait_ref).map(|c| (*c).clone())
+        hashmap.get(&cache_fresh_trait_pred.0.trait_ref).cloned()
     }
 
     fn insert_candidate_cache(&mut self,
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index 9ea7a276d97c6..9b64e87202b26 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -1153,7 +1153,7 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 let trait_ref =
                     bcx.tcx().object_cast_map.borrow()
                                              .get(&expr.id)
-                                             .map(|t| (*t).clone())
+                                             .cloned()
                                              .unwrap();
                 let trait_ref = bcx.monomorphize(&trait_ref);
                 let datum = unpack_datum!(bcx, trans(bcx, &**val));
diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs
index 9d1c0fadefcd2..546c62e5dd247 100644
--- a/src/librustc_trans/trans/type_of.rs
+++ b/src/librustc_trans/trans/type_of.rs
@@ -67,7 +67,7 @@ pub fn untuple_arguments_if_necessary<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                 abi: abi::Abi)
                                                 -> Vec> {
     if abi != abi::RustCall {
-        return inputs.iter().map(|x| (*x).clone()).collect()
+        return inputs.iter().cloned().collect()
     }
 
     if inputs.len() == 0 {
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index ac1a02854124a..c52b0bab1fa8b 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -333,7 +333,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
                     name: name,
                     items: items.clone(),
                     generics: gen.clone(),
-                    bounds: b.iter().map(|x| (*x).clone()).collect(),
+                    bounds: b.iter().cloned().collect(),
                     id: item.id,
                     attrs: item.attrs.clone(),
                     whence: item.span,
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index c7dd41722ff6f..dba92009a962d 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -410,7 +410,7 @@ impl<'a> TraitDef<'a> {
         let mut ty_params = ty_params.into_vec();
 
         // Copy the lifetimes
-        lifetimes.extend(generics.lifetimes.iter().map(|l| (*l).clone()));
+        lifetimes.extend(generics.lifetimes.iter().cloned());
 
         // Create the type parameters.
         ty_params.extend(generics.ty_params.iter().map(|ty_param| {
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index d752e34c11253..7e996f46c4b07 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -282,9 +282,7 @@ pub fn parse(sess: &ParseSess,
              ms: &[TokenTree])
              -> ParseResult {
     let mut cur_eis = Vec::new();
-    cur_eis.push(initial_matcher_pos(Rc::new(ms.iter()
-                                                .map(|x| (*x).clone())
-                                                .collect()),
+    cur_eis.push(initial_matcher_pos(Rc::new(ms.iter().cloned().collect()),
                                      None,
                                      rdr.peek().sp.lo));
 
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index de61bdefa5de3..e899b46c009d1 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -160,7 +160,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
                                                       None,
                                                       None,
                                                       arg.iter()
-                                                         .map(|x| (*x).clone())
+                                                         .cloned()
                                                          .collect(),
                                                       true);
             match parse(cx.parse_sess(), cx.cfg(), arg_rdr, lhs_tt) {
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index b17fc7fe82e6c..6f5da94f21059 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -82,7 +82,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
         while j > i && lines[j - 1].trim().is_empty() {
             j -= 1;
         }
-        return lines[i..j].iter().map(|x| (*x).clone()).collect();
+        return lines[i..j].iter().cloned().collect();
     }
 
     /// remove a "[ \t]*\*" block from each line, if possible

From 805a31fb760873d3b973699403866ca08e8999ca Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:11:41 -0500
Subject: [PATCH 12/19] Improve documentation for `Select::new()`.

Remove incorrect claim, add example, reformat and re-word.

Fixes #22266
---
 src/libstd/sync/mpsc/select.rs | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index babae93b2d440..87b2fe8f100c3 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -111,11 +111,18 @@ pub trait Packet {
 }
 
 impl Select {
-    /// Creates a new selection structure. This set is initially empty and
-    /// `wait` will panic!() if called.
+    /// Creates a new selection structure. This set is initially empty.
     ///
-    /// Usage of this struct directly can sometimes be burdensome, and usage is
-    /// rather much easier through the `select!` macro.
+    /// Usage of this struct directly can sometimes be burdensome, and usage is much easier through
+    /// the `select!` macro.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::sync::mpsc::Select;
+    ///
+    /// let select = Select::new();
+    /// ```
     pub fn new() -> Select {
         Select {
             head: ptr::null_mut(),

From 58a7d586869b3d822037d339b26c03fd53ea08c8 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:37:05 -0500
Subject: [PATCH 13/19] Re-word paragraph about enums and equality

Fixes #22035.
---
 src/doc/trpl/compound-data-types.md | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/doc/trpl/compound-data-types.md b/src/doc/trpl/compound-data-types.md
index 51a4edbdac802..dea19fa73fb49 100644
--- a/src/doc/trpl/compound-data-types.md
+++ b/src/doc/trpl/compound-data-types.md
@@ -263,15 +263,12 @@ let four_is_smaller = four <= ten;
 let four_equals_ten = four == ten;
 ```
 
-This may seem rather limiting, particularly equality being invalid; in
-many cases however, it's unnecessary. Rust provides the [`match`][match]
-keyword, which will be examined in more detail in the next section, which
-often allows better and easier branch control than a series of `if`/`else`
-statements would. However, for our [game][game] we need the comparisons
-to work so we will utilize the `Ordering` `enum` provided by the standard
-library which supports such comparisons. It has this form:
+This may seem rather limiting, but it's a limitation which we can overcome.
+There are two ways: by implementing equality ourselves, or by using the
+[`match`][match] keyword. We don't know enough about Rust to implement equality
+yet, but we can use the `Ordering` enum from the standard library, which does:
 
-```{rust}
+```
 enum Ordering {
     Less,
     Equal,

From d414a3919740726e18897b6e39f66e8a25f00a5c Mon Sep 17 00:00:00 2001
From: "Felix S. Klock II" 
Date: Fri, 13 Feb 2015 15:48:05 +0100
Subject: [PATCH 14/19] Re-tag `slicing_syntax` as `Accepted`.

Rollup merge (373cbab5b08d6630da58f28d2166c19afc327fa6) of PR #20723
accidentally reverted a portion of commit
8327bcc167661c26ca5c6b967309ff745d302329 which shifted
`slicing_syntax` from Active to Accepted.
---
 src/libsyntax/feature_gate.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index ca7ae32f09ec9..d7cc4adaa5787 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -79,7 +79,7 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
     ("tuple_indexing", "1.0.0", Accepted),
     ("associated_types", "1.0.0", Accepted),
     ("visible_private_types", "1.0.0", Active),
-    ("slicing_syntax", "1.0.0", Active),
+    ("slicing_syntax", "1.0.0", Accepted),
     ("box_syntax", "1.0.0", Active),
     ("on_unimplemented", "1.0.0", Active),
     ("simd_ffi", "1.0.0", Active),

From c9ad0d13a376f8a88408be221c2117a9c9568141 Mon Sep 17 00:00:00 2001
From: Ruud van Asseldonk 
Date: Fri, 13 Feb 2015 16:29:31 +0100
Subject: [PATCH 15/19] Revert incorrect map(|x| *x) -> cloned() substitutions.

---
 src/librustc_back/rpath.rs | 2 +-
 src/libtest/lib.rs         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/librustc_back/rpath.rs b/src/librustc_back/rpath.rs
index 7756f87162e6b..36bbd4b987297 100644
--- a/src/librustc_back/rpath.rs
+++ b/src/librustc_back/rpath.rs
@@ -41,7 +41,7 @@ pub fn get_rpath_flags(config: RPathConfig) -> Vec where
 
     let libs = config.used_crates.clone();
     let libs = libs.into_iter().filter_map(|(_, l)| {
-        l.cloned()
+        l.map(|p| p.clone())
     }).collect::>();
 
     let rpaths = get_rpaths(config, &libs[]);
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index be22a76a7671a..cc468df87f383 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -938,7 +938,7 @@ fn calc_result(desc: &TestDesc, task_result: Result<(), Box>) -> TestR
         (&ShouldFail::Yes(Some(msg)), Err(ref err))
             if err.downcast_ref::()
                 .map(|e| &**e)
-                .or_else(|| err.downcast_ref::<&'static str>().cloned())
+                .or_else(|| err.downcast_ref::<&'static str>().map(|e| *e))
                 .map(|e| e.contains(msg))
                 .unwrap_or(false) => TrOk,
         _ => TrFailed,

From a7d5c3f682002157c9d74cce773fb792d92333e1 Mon Sep 17 00:00:00 2001
From: "Felix S. Klock II" 
Date: Fri, 13 Feb 2015 16:42:22 +0100
Subject: [PATCH 16/19] Added all active features to the list in reference.md.

Added a second note about keeping the reference.md list up-to-date to
the bottom of the list, since not everyone (including me) reads the
big comment at the top of it.  :)

Ensured that the feature gate list in reference.md is kept in
alphabetical order.
---
 src/doc/reference.md          | 62 +++++++++++++++++++++++++++++------
 src/libsyntax/feature_gate.rs |  1 +
 2 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 9c51f6bad6fee..18fdf38ffd501 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2377,21 +2377,33 @@ considered off, and using the features will result in a compiler error.
 
 The currently implemented features of the reference compiler are:
 
+* `advanced_slice_patterns` - see the [match expressions](#match-expressions)
+                              section for discussion; the exact semantics of
+                              slice patterns are subject to change.
+
 * `asm` - The `asm!` macro provides a means for inline assembly. This is often
           useful, but the exact syntax for this feature along with its
           semantics are likely to change, so this macro usage must be opted
           into.
 
+* `associated_types` - Allows type aliases in traits. Experimental.
+
+* `box_patterns` - Allows `box` patterns, the exact semantics of which
+                   is subject to change.
+
+* `box_syntax` - Allows use of `box` expressions, the exact semantics of which
+                 is subject to change.
+
 * `concat_idents` - Allows use of the `concat_idents` macro, which is in many
                     ways insufficient for concatenating identifiers, and may be
                     removed entirely for something more wholesome.
 
-* `default_type_params` - Allows use of default type parameters. The future of
-                          this feature is uncertain.
-
 * `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
                  are inherently unstable and no promise about them is made.
 
+* `int_uint` - Allows the use of the `int` and `uint` types, which are deprecated.
+               Use `isize` and `usize` instead.
+
 * `lang_items` - Allows use of the `#[lang]` attribute. Like `intrinsics`,
                  lang items are inherently unstable and no promise about them
                  is made.
@@ -2410,12 +2422,33 @@ The currently implemented features of the reference compiler are:
 * `log_syntax` - Allows use of the `log_syntax` macro attribute, which is a
                  nasty hack that will certainly be removed.
 
+* `main` - Allows use of the `#[main]` attribute, which changes the entry point
+           into a Rust program. This capabiilty is subject to change.
+
+* `macro_reexport` - Allows macros to be re-exported from one crate after being imported
+                     from another. This feature was originally designed with the sole
+                     use case of the Rust standard library in mind, and is subject to
+                     change.
+
 * `non_ascii_idents` - The compiler supports the use of non-ascii identifiers,
                        but the implementation is a little rough around the
                        edges, so this can be seen as an experimental feature
                        for now until the specification of identifiers is fully
                        fleshed out.
 
+* `no_std` - Allows the `#![no_std]` crate attribute, which disables the implicit
+             `extern crate std`. This typically requires use of the unstable APIs
+             behind the libstd "facade", such as libcore and libcollections. It
+             may also cause problems when using syntax extensions, including
+             `#[derive]`.
+
+* `on_unimplemented` - Allows the `#[rustc_on_unimplemented]` attribute, which allows
+                       trait definitions to add specialized notes to error messages
+                       when an implementation was expected but not found.
+
+* `optin_builtin_traits` - Allows the definition of default and negative trait
+                           implementations. Experimental.
+
 * `plugin` - Usage of [compiler plugins][plugin] for custom lints or syntax extensions.
              These depend on compiler internals and are subject to change.
 
@@ -2431,8 +2464,15 @@ The currently implemented features of the reference compiler are:
 * `simd` - Allows use of the `#[simd]` attribute, which is overly simple and
            not the SIMD interface we want to expose in the long term.
 
+* `simd_ffi` - Allows use of SIMD vectors in signatures for foreign functions.
+               The SIMD interface is subject to change.
+
 * `staged_api` - Allows usage of stability markers and `#![staged_api]` in a crate
 
+* `start` - Allows use of the `#[start]` attribute, which changes the entry point
+            into a Rust program. This capabiilty, especially the signature for the
+            annotated function, is subject to change.
+
 * `struct_inherit` - Allows using struct inheritance, which is barely
                      implemented and will probably be removed. Don't use this.
 
@@ -2460,18 +2500,20 @@ The currently implemented features of the reference compiler are:
                         which is considered wildly unsafe and will be
                         obsoleted by language improvements.
 
+* `unsafe_no_drop_flag` - Allows use of the `#[unsafe_no_drop_flag]` attribute,
+                          which removes hidden flag added to a type that
+                          implements the `Drop` trait. The design for the
+                          `Drop` flag is subject to change, and this feature
+                          may be removed in the future.
+
 * `unmarked_api` - Allows use of items within a `#![staged_api]` crate
                    which have not been marked with a stability marker.
                    Such items should not be allowed by the compiler to exist,
                    so if you need this there probably is a compiler bug.
 
-* `associated_types` - Allows type aliases in traits. Experimental.
-
-* `no_std` - Allows the `#![no_std]` crate attribute, which disables the implicit
-             `extern crate std`. This typically requires use of the unstable APIs
-             behind the libstd "facade", such as libcore and libcollections. It
-             may also cause problems when using syntax extensions, including
-             `#[derive]`.
+* `visible_private_types` - Allows public APIs to expose otherwise private
+                            types, e.g. as the return type of a public function.
+                            This capability may be removed in the future.
 
 If a feature is promoted to a language feature, then all existing programs will
 start to receive compilation warnings about #[feature] directives which enabled
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index ca7ae32f09ec9..12965863b22b0 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -134,6 +134,7 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
     // switch to Accepted; see RFC 320)
     ("unsafe_no_drop_flag", "1.0.0", Active),
 ];
+// (changing above list without updating src/doc/reference.md makes @cmr sad)
 
 enum Status {
     /// Represents an active feature that is currently being implemented or

From fb05f282d7810f93c9dcb0ef979e66648a8716fc Mon Sep 17 00:00:00 2001
From: Niko Matsakis 
Date: Thu, 12 Feb 2015 12:53:31 -0500
Subject: [PATCH 17/19] Add `#[rustc_error]` annotation, which causes trans to
 signal an error if found on the `main()` function. This lets you write tests
 that live in `compile-fail` but are expected to compile successfully. This is
 handy when you have many small variations on a theme that you want to keep
 together, and you are just testing the type checker, not the runtime
 semantics.

---
 src/librustc/lint/builtin.rs         |  1 +
 src/librustc_trans/trans/base.rs     |  8 ++++++++
 src/test/compile-fail/rustc-error.rs | 14 ++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 src/test/compile-fail/rustc-error.rs

diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index a415ff3ed7165..0b014c4818d04 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -674,6 +674,7 @@ impl LintPass for UnusedAttributes {
             "stable",
             "unstable",
             "rustc_on_unimplemented",
+            "rustc_error",
 
             // FIXME: #19470 this shouldn't be needed forever
             "old_orphan_check",
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index 52ef2b75f9571..54c50b7a62b5d 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -2425,6 +2425,14 @@ fn finish_register_fn(ccx: &CrateContext, sp: Span, sym: String, node_id: ast::N
 
 
     if is_entry_fn(ccx.sess(), node_id) {
+        // check for the #[rustc_error] annotation, which forces an
+        // error in trans. This is used to write compile-fail tests
+        // that actually test that compilation succeeds without
+        // reporting an error.
+        if ty::has_attr(ccx.tcx(), local_def(node_id), "rustc_error") {
+            ccx.tcx().sess.span_fatal(sp, "compilation successful");
+        }
+
         create_entry_wrapper(ccx, sp, llfn);
     }
 }
diff --git a/src/test/compile-fail/rustc-error.rs b/src/test/compile-fail/rustc-error.rs
new file mode 100644
index 0000000000000..6497439c3dc57
--- /dev/null
+++ b/src/test/compile-fail/rustc-error.rs
@@ -0,0 +1,14 @@
+// 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  or the MIT license
+// , at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[rustc_error]
+fn main() {
+    //~^ ERROR compilation successful
+}

From f48eda8dc9097199eba21d5a39263160b2fbeb8a Mon Sep 17 00:00:00 2001
From: Renato Alves 
Date: Fri, 13 Feb 2015 17:09:46 +0000
Subject: [PATCH 18/19] Fix small copy-paste typo

---
 src/doc/trpl/functions.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doc/trpl/functions.md b/src/doc/trpl/functions.md
index d0ecb6067955d..450b28bd80d24 100644
--- a/src/doc/trpl/functions.md
+++ b/src/doc/trpl/functions.md
@@ -60,7 +60,7 @@ not work:
 
 ```{ignore}
 fn print_sum(x, y) {
-    println!("x is: {}", x + y);
+    println!("sum is: {}", x + y);
 }
 ```
 

From 7ac46e19329ff54cb8c1ba479a64492fec5981e1 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 16:44:09 -0500
Subject: [PATCH 19/19] Remove slicing_syntax feature gate

... as it is no longer needed.
---
 src/libcore/lib.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index a122bcb2c7aed..7243bd4f0cb25 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -64,7 +64,7 @@
 #![feature(int_uint)]
 #![feature(intrinsics, lang_items)]
 #![feature(on_unimplemented)]
-#![feature(simd, unsafe_destructor, slicing_syntax)]
+#![feature(simd, unsafe_destructor)]
 #![feature(staged_api)]
 #![feature(unboxed_closures)]