From 995b1591579051fc7f40d1861f847bfe36d96282 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Fri, 13 Feb 2015 00:47:03 +0900 Subject: [PATCH 01/54] 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/54] 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 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 03/54] 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 04/54] 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 e4a9eb95ce4a457e800571d86942561ada28304a Mon Sep 17 00:00:00 2001
From: Huon Wilson 
Date: Fri, 13 Feb 2015 14:40:57 +1100
Subject: [PATCH 05/54] 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 be440bc8a6ee531d0966e1aa1b42839fd8381b92 Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Wed, 11 Feb 2015 13:14:28 -0800
Subject: [PATCH 06/54] Upgrade rust-installer

---
 mk/dist.mk         | 21 +++++++++++----------
 src/rust-installer |  2 +-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/mk/dist.mk b/mk/dist.mk
index 05af3f2123227..831225556f3fc 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -109,8 +109,6 @@ distcheck-tar-src: dist-tar-src
 # Unix binary installer tarballs
 ######################################################################
 
-NON_INSTALLED_PREFIXES=COPYRIGHT,LICENSE-APACHE,LICENSE-MIT,README.md,version
-
 define DEF_INSTALLER
 
 $$(eval $$(call DEF_PREPARE,dir-$(1)))
@@ -124,19 +122,23 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
 dist-install-dir-$(1): PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
 dist-install-dir-$(1): PREPARE_CLEAN=true
 dist-install-dir-$(1): prepare-base-dir-$(1) docs compiler-docs
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)
-	$$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)
 	$$(Q)mkdir -p $$(PREPARE_DEST_DIR)/share/doc/rust
 	$$(Q)$$(PREPARE_MAN_CMD) $$(S)COPYRIGHT $$(PREPARE_DEST_DIR)/share/doc/rust
 	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-APACHE $$(PREPARE_DEST_DIR)/share/doc/rust
 	$$(Q)$$(PREPARE_MAN_CMD) $$(S)LICENSE-MIT $$(PREPARE_DEST_DIR)/share/doc/rust
 	$$(Q)$$(PREPARE_MAN_CMD) $$(S)README.md $$(PREPARE_DEST_DIR)/share/doc/rust
+
+prepare-overlay-$(1):
+	$$(Q)rm -Rf tmp/dist/$$(PKG_NAME)-$(1)-overlay
+	$$(Q)mkdir -p tmp/dist/$$(PKG_NAME)-$(1)-overlay
+	$$(Q)cp $$(S)COPYRIGHT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
+	$$(Q)cp $$(S)LICENSE-APACHE tmp/dist/$$(PKG_NAME)-$(1)-overlay/
+	$$(Q)cp $$(S)LICENSE-MIT tmp/dist/$$(PKG_NAME)-$(1)-overlay/
+	$$(Q)cp $$(S)README.md tmp/dist/$$(PKG_NAME)-$(1)-overlay/
 # This tiny morsel of metadata is used by rust-packaging
-	$$(Q)echo "$(CFG_VERSION)" > $$(PREPARE_DEST_DIR)/version
+	$$(Q)echo "$(CFG_VERSION)" > tmp/dist/$$(PKG_NAME)-$(1)-overlay/version
 
-dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1)
+dist/$$(PKG_NAME)-$(1).tar.gz: dist-install-dir-$(1) prepare-overlay-$(1)
 	@$(call E, build: $$@)
 # Copy essential gcc components into installer
 ifdef CFG_WINDOWSY_$(1)
@@ -146,13 +148,12 @@ ifdef CFG_WINDOWSY_$(1)
 endif
 	$$(Q)$$(S)src/rust-installer/gen-installer.sh \
 		--product-name=Rust \
-		--verify-bin=rustc \
 		--rel-manifest-dir=rustlib \
 		--success-message=Rust-is-ready-to-roll. \
 		--image-dir=tmp/dist/$$(PKG_NAME)-$(1)-image \
 		--work-dir=tmp/dist \
 		--output-dir=dist \
-		--non-installed-prefixes=$$(NON_INSTALLED_PREFIXES) \
+		--non-installed-overlay=tmp/dist/$$(PKG_NAME)-$(1)-overlay \
 		--package-name=$$(PKG_NAME)-$(1) \
 		--component-name=rustc \
 		--legacy-manifest-dirs=rustlib,cargo
diff --git a/src/rust-installer b/src/rust-installer
index e577c97b494be..60fd8abfcae50 160000
--- a/src/rust-installer
+++ b/src/rust-installer
@@ -1 +1 @@
-Subproject commit e577c97b494be2815b215e3042207d6d4b7c5516
+Subproject commit 60fd8abfcae50629a3fc664bd809238fed039617

From b2f70a415943c42ac13714d41db4db2f6a862b74 Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Thu, 12 Feb 2015 19:19:35 -0800
Subject: [PATCH 07/54] Update uninstall instructions

---
 src/doc/trpl/installing-rust.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/doc/trpl/installing-rust.md b/src/doc/trpl/installing-rust.md
index 80288c4c3d9ca..5bc33d0a232ea 100644
--- a/src/doc/trpl/installing-rust.md
+++ b/src/doc/trpl/installing-rust.md
@@ -24,11 +24,11 @@ installer](https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.
 and run it.
 
 If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
-Not every programming language is great for everyone. Just pass an argument to
-the script:
+Not every programming language is great for everyone. Just run the uninstall
+script:
 
 ```bash
-$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall
+$ sudo /usr/local/lib/rustlib/uninstall.sh
 ```
 
 If you used the Windows installer, just re-run the `.exe` and it will give you

From 8dcc886d68ea87a84cb3121bc691da2fa8ce8887 Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Thu, 12 Feb 2015 19:30:43 -0800
Subject: [PATCH 08/54] Change README quick start instructions to defer
 entirely to the book.

---
 README.md | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 605c2fc9a611a..28a622c4fcce5 100644
--- a/README.md
+++ b/README.md
@@ -5,16 +5,10 @@ documentation.
 
 ## Quick Start
 
-1. Download a [binary installer][installer] for your platform.
-2. Read [The Rust Programming Language][trpl].
-3. Enjoy!
+Read ["Installing Rust"][install] from [The Book][trpl].
 
-> ***Note:*** Windows users can read the detailed
-> [using Rust on Windows][win-wiki] notes on the wiki.
-
-[installer]: http://www.rust-lang.org/install.html
+[install]: http://doc.rust-lang.org/book/installing-rust.html
 [trpl]: http://doc.rust-lang.org/book/index.html
-[win-wiki]: https://github.com/rust-lang/rust/wiki/Using-Rust-on-Windows
 
 ## Building from Source
 

From 9df38bf6583ff27e5184513b397955d3b169bbdf Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Thu, 12 Feb 2015 19:33:03 -0800
Subject: [PATCH 09/54] Remove some irrelevant text from README

The quick start already links to the book. I think its not necessary
to do in the build instructions.
---
 README.md | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/README.md b/README.md
index 28a622c4fcce5..9d7c939ff9de8 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,6 @@ Read ["Installing Rust"][install] from [The Book][trpl].
     When complete, `make install` will place several programs into
     `/usr/local/bin`: `rustc`, the Rust compiler, and `rustdoc`, the
     API-documentation tool.
-3. Read [The Rust Programming Language][trpl].
-4. Enjoy!
 
 ### Building on Windows
 
@@ -75,7 +73,6 @@ $ pacman -S base-devel
 
 [repo]: https://github.com/rust-lang/rust
 [tarball]: https://static.rust-lang.org/dist/rustc-nightly-src.tar.gz
-[trpl]: http://doc.rust-lang.org/book/index.html
 
 ## Notes
 

From b4a286144dfbc587604353be2fb3c9e27d405f9e Mon Sep 17 00:00:00 2001
From: Chris Wong 
Date: Fri, 13 Feb 2015 19:23:28 +1300
Subject: [PATCH 10/54] Rename the "unsafe" lang item to "unsafe_cell"

---
 src/libcore/cell.rs                  | 3 ++-
 src/librustc/middle/lang_items.rs    | 2 +-
 src/librustc/middle/traits/select.rs | 2 +-
 src/librustc/middle/ty.rs            | 2 +-
 src/librustc_typeck/variance.rs      | 2 +-
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs
index 050b34508ff87..cf293ded13f00 100644
--- a/src/libcore/cell.rs
+++ b/src/libcore/cell.rs
@@ -649,7 +649,8 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
 ///
 /// **NOTE:** `UnsafeCell`'s fields are public to allow static initializers. It is not
 /// recommended to access its fields directly, `get` should be used instead.
-#[lang="unsafe"]
+#[cfg_attr(stage0, lang="unsafe")]  // NOTE: remove after next snapshot
+#[cfg_attr(not(stage0), lang="unsafe_cell")]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct UnsafeCell {
     /// Wrapped value
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index ef72c2242c1e7..e13a5672778e2 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -271,7 +271,7 @@ lets_do_this! {
     RangeToStructLangItem,           "range_to",                range_to_struct;
     RangeFullStructLangItem,         "range_full",              range_full_struct;
 
-    UnsafeTypeLangItem,              "unsafe",                  unsafe_type;
+    UnsafeCellTypeLangItem,          "unsafe_cell",             unsafe_cell_type;
 
     DerefTraitLangItem,              "deref",                   deref_trait;
     DerefMutTraitLangItem,           "deref_mut",               deref_mut_trait;
diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs
index 5f659aa303e90..6f58f4655fed1 100644
--- a/src/librustc/middle/traits/select.rs
+++ b/src/librustc/middle/traits/select.rs
@@ -1654,7 +1654,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 ty::BoundSync => {
                     if
                         Some(def_id) == tcx.lang_items.managed_bound() ||
-                        Some(def_id) == tcx.lang_items.unsafe_type()
+                        Some(def_id) == tcx.lang_items.unsafe_cell_type()
                     {
                         return Err(Unimplemented)
                     }
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index 6026359ddace0..e276683236f86 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -3577,7 +3577,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
                         -> TypeContents {
         if Some(did) == cx.lang_items.managed_bound() {
             tc | TC::Managed
-        } else if Some(did) == cx.lang_items.unsafe_type() {
+        } else if Some(did) == cx.lang_items.unsafe_cell_type() {
             tc | TC::InteriorUnsafe
         } else {
             tc
diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs
index 567a388836f25..66fce6dded34f 100644
--- a/src/librustc_typeck/variance.rs
+++ b/src/librustc_typeck/variance.rs
@@ -453,7 +453,7 @@ fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
     invariant_lang_items[RegionParam as uint] =
         terms_cx.tcx.lang_items.invariant_lifetime();
 
-    let unsafe_lang_item = terms_cx.tcx.lang_items.unsafe_type();
+    let unsafe_lang_item = terms_cx.tcx.lang_items.unsafe_cell_type();
 
     let covariant = terms_cx.arena.alloc(ConstantTerm(ty::Covariant));
     let contravariant = terms_cx.arena.alloc(ConstantTerm(ty::Contravariant));

From aef55517519682764c08b0471692e5b0377a8c10 Mon Sep 17 00:00:00 2001
From: Chris Wong 
Date: Fri, 13 Feb 2015 19:27:56 +1300
Subject: [PATCH 11/54] Rename `unsafe_lang_item` to `unsafe_cell_lang_item`

---
 src/librustc_typeck/variance.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs
index 66fce6dded34f..d5883d8bf864b 100644
--- a/src/librustc_typeck/variance.rs
+++ b/src/librustc_typeck/variance.rs
@@ -412,7 +412,7 @@ struct ConstraintContext<'a, 'tcx: 'a> {
     invariant_lang_items: [Option; 2],
     covariant_lang_items: [Option; 2],
     contravariant_lang_items: [Option; 2],
-    unsafe_lang_item: Option,
+    unsafe_cell_lang_item: Option,
 
     // These are pointers to common `ConstantTerm` instances
     covariant: VarianceTermPtr<'a>,
@@ -453,7 +453,7 @@ fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
     invariant_lang_items[RegionParam as uint] =
         terms_cx.tcx.lang_items.invariant_lifetime();
 
-    let unsafe_lang_item = terms_cx.tcx.lang_items.unsafe_cell_type();
+    let unsafe_cell_lang_item = terms_cx.tcx.lang_items.unsafe_cell_type();
 
     let covariant = terms_cx.arena.alloc(ConstantTerm(ty::Covariant));
     let contravariant = terms_cx.arena.alloc(ConstantTerm(ty::Contravariant));
@@ -465,7 +465,7 @@ fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>,
         invariant_lang_items: invariant_lang_items,
         covariant_lang_items: covariant_lang_items,
         contravariant_lang_items: contravariant_lang_items,
-        unsafe_lang_item: unsafe_lang_item,
+        unsafe_cell_lang_item: unsafe_cell_lang_item,
 
         covariant: covariant,
         contravariant: contravariant,
@@ -654,7 +654,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
             self.covariant
         } else if self.contravariant_lang_items[kind as uint] == Some(item_def_id) {
             self.contravariant
-        } else if kind == TypeParam && Some(item_def_id) == self.unsafe_lang_item {
+        } else if kind == TypeParam && Some(item_def_id) == self.unsafe_cell_lang_item {
             self.invariant
         } else if param_def_id.krate == ast::LOCAL_CRATE {
             // Parameter on an item defined within current crate:

From c5dba7275a931994040aab4890f59c704c5d0b58 Mon Sep 17 00:00:00 2001
From: Kevin Yap 
Date: Thu, 12 Feb 2015 23:25:36 -0800
Subject: [PATCH 12/54] 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 f28a33359bc56928a89483fbcf3d4f3707e3ebe8 Mon Sep 17 00:00:00 2001
From: Florian Hahn 
Date: Fri, 13 Feb 2015 10:24:05 +0100
Subject: [PATCH 13/54] Make if after colon lowercase

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

diff --git a/src/doc/trpl/more-strings.md b/src/doc/trpl/more-strings.md
index 986ad23c665a7..b27638435089d 100644
--- a/src/doc/trpl/more-strings.md
+++ b/src/doc/trpl/more-strings.md
@@ -91,7 +91,7 @@ and only moving to this:
 fn foo(s: String) {
 ```
 
-If you have good reason. It's not polite to hold on to ownership you don't
+if you have good reason. It's not polite to hold on to ownership you don't
 need, and it can make your lifetimes more complex.
 
 ## Generic functions

From ce22f30b9e9dc95e576b73e21f0c653ff46e28c2 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Mon, 9 Feb 2015 22:24:49 -0500
Subject: [PATCH 14/54] Make note of doc duplication with reexports

Fixes #16645
---
 src/doc/trpl/documentation.md | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/doc/trpl/documentation.md b/src/doc/trpl/documentation.md
index 0b686eb76dbfb..2651949747952 100644
--- a/src/doc/trpl/documentation.md
+++ b/src/doc/trpl/documentation.md
@@ -1,4 +1,4 @@
-% Rust Documentation
+% Documentation
 
 `rustdoc` is the built-in tool for generating documentation. It integrates
 with the compiler to provide accurate hyperlinking between usage of types and
@@ -294,3 +294,26 @@ Documentation` on the first line).
 Like with a Rust crate, the `--test` argument will run the code
 examples to check they compile, and obeys any `--test-args` flags. The
 tests are named after the last `#` heading.
+
+# Re-exports
+
+Rustdoc will show the documentation for a publc re-export in both places:
+
+```{rust,ignore}
+extern crate foo;
+
+pub use foo::bar;
+```
+
+This will create documentation for `bar` both inside the documentation for
+the crate `foo`, as well as the documentation for your crate. It will use
+the same documentation in both places.
+
+This behavior can be supressed with `no_inline`:
+
+```{rust,ignore}
+extern crate foo;
+
+#[doc(no_inline)]
+pub use foo::bar;
+```

From 805a31fb760873d3b973699403866ca08e8999ca Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:11:41 -0500
Subject: [PATCH 15/54] 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 4b25d7528bf6353fc56315683fce580ae1d360a9 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:21:38 -0500
Subject: [PATCH 16/54] Remove outdated information about copy/move from the
 reference

Fixes #22136
---
 src/doc/reference.md | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 9c51f6bad6fee..5317de0e8784d 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2591,9 +2591,8 @@ of any reference that points to it.
 
 When a [local variable](#memory-slots) is used as an
 [rvalue](#lvalues,-rvalues-and-temporaries) the variable will either be moved
-or copied, depending on its type. For types that contain [owning
-pointers](#pointer-types) or values that implement the special trait `Drop`,
-the variable is moved. All other types are copied.
+or copied, depending on its type. All values whose type implements `Copy` are
+copied, all others are moved.
 
 ### Literal expressions
 

From 58a7d586869b3d822037d339b26c03fd53ea08c8 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:37:05 -0500
Subject: [PATCH 17/54] 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 114301f4f2e8ca069fd50c238a92ba8e31b5c272 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 09:39:36 -0500
Subject: [PATCH 18/54] Refer to LLVM rather than GCC wiki for atomic orderings

Fixes #22064.
---
 src/libcore/atomic.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcore/atomic.rs b/src/libcore/atomic.rs
index 0f3823eb7a5b0..32e8cffcae4f9 100644
--- a/src/libcore/atomic.rs
+++ b/src/libcore/atomic.rs
@@ -21,9 +21,9 @@
 //!
 //! Each method takes an `Ordering` which represents the strength of
 //! the memory barrier for that operation. These orderings are the
-//! same as [C++11 atomic orderings][1].
+//! same as [LLVM atomic orderings][1].
 //!
-//! [1]: http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync
+//! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
 //!
 //! Atomic variables are safe to share between threads (they implement `Sync`)
 //! but they do not themselves provide the mechanism for sharing. The most

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 19/54] 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 65eab6eb979ecaff246d618666151bf5317211fb Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 10:05:33 -0500
Subject: [PATCH 20/54] Add diverging functions to the book.

We use them in some places, but never actually talk about the syntax.
---
 src/doc/trpl/functions.md | 53 ++++++++++++++++++++++++++++++---------
 1 file changed, 41 insertions(+), 12 deletions(-)

diff --git a/src/doc/trpl/functions.md b/src/doc/trpl/functions.md
index d0ecb6067955d..e212af5194b8e 100644
--- a/src/doc/trpl/functions.md
+++ b/src/doc/trpl/functions.md
@@ -2,7 +2,7 @@
 
 You've already seen one function so far, the `main` function:
 
-```{rust}
+```rust
 fn main() {
 }
 ```
@@ -12,14 +12,14 @@ This is the simplest possible function declaration. As we mentioned before,
 this function takes no arguments, and then some curly braces to indicate the
 body. Here's a function named `foo`:
 
-```{rust}
+```rust
 fn foo() {
 }
 ```
 
 So, what about taking arguments? Here's a function that prints a number:
 
-```{rust}
+```rust
 fn print_number(x: i32) {
     println!("x is: {}", x);
 }
@@ -27,7 +27,7 @@ fn print_number(x: i32) {
 
 Here's a complete program that uses `print_number`:
 
-```{rust}
+```rust
 fn main() {
     print_number(5);
 }
@@ -42,7 +42,7 @@ you add a type to the argument name, after a colon.
 
 Here's a complete program that adds two numbers together and prints them:
 
-```{rust}
+```rust
 fn main() {
     print_sum(5, 6);
 }
@@ -58,7 +58,7 @@ as when you declare it.
 Unlike `let`, you _must_ declare the types of function arguments. This does
 not work:
 
-```{ignore}
+```{rust,ignore}
 fn print_sum(x, y) {
     println!("x is: {}", x + y);
 }
@@ -79,7 +79,7 @@ sweet spot between full inference and no inference.
 
 What about returning a value? Here's a function that adds one to an integer:
 
-```{rust}
+```rust
 fn add_one(x: i32) -> i32 {
     x + 1
 }
@@ -90,7 +90,7 @@ Rust functions return exactly one value, and you declare the type after an
 
 You'll note the lack of a semicolon here. If we added it in:
 
-```{ignore}
+```{rust,ignore}
 fn add_one(x: i32) -> i32 {
     x + 1;
 }
@@ -123,7 +123,7 @@ semicolon in a return position would cause a bug.
 
 But what about early returns? Rust does have a keyword for that, `return`:
 
-```{rust}
+```rust
 fn foo(x: i32) -> i32 {
     if x < 5 { return x; }
 
@@ -134,7 +134,7 @@ fn foo(x: i32) -> i32 {
 Using a `return` as the last line of a function works, but is considered poor
 style:
 
-```{rust}
+```rust
 fn foo(x: i32) -> i32 {
     if x < 5 { return x; }
 
@@ -160,5 +160,34 @@ fn foo(x: i32) -> i32 {
 Because `if` is an expression, and it's the only expression in this function,
 the value will be the result of the `if`.
 
-There are some additional ways to define functions, but they involve features
-that we haven't learned about yet, so let's just leave it at that for now.
+## Diverging functions
+
+Rust has some special syntax for 'diverging functions', which are functions that
+do not return:
+
+```
+fn diverges() -> ! {
+    panic!("This function never returns!");
+}
+```
+
+`panic!` is a macro, similar to `println!()` that we've already seen. Unlike
+`println!()`, `panic!()` causes the current thread of execution to crash with
+the given message.
+
+Because this function will cause a crash, it will never return, and so it has
+the type '`!`', which is read "diverges." A diverging function can be used
+as any type:
+
+```should_fail
+# fn diverges() -> ! {
+#    panic!("This function never returns!");
+# }
+
+let x: i32 = diverges();
+let x: String = diverges();
+```
+
+We don't have a good use for diverging functions yet, because they're used in
+conjunction with other Rust features. But when you see `-> !` later, you'll
+know what it's called.

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 21/54] 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 22/54] 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 23/54] 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 e478f660d8983896637635f616d3501b6ad1f4dc Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 12:53:54 -0500
Subject: [PATCH 24/54] Don't specify tuple layout.

This isn't something we want to guarantee.
---
 src/doc/reference.md | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 9c51f6bad6fee..c2c87fb36dd21 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -3502,9 +3502,6 @@ elements, respectively, in a parenthesized, comma-separated list.
 Because tuple elements don't have a name, they can only be accessed by
 pattern-matching.
 
-The members of a tuple are laid out in memory contiguously, in order specified
-by the tuple type.
-
 An example of a tuple type and its use:
 
 ```

From 9eb443618810dc7d9922ef636b93e8c256855031 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 13:47:09 -0500
Subject: [PATCH 25/54] Add link to module-level Option documentation.

---
 src/libcore/option.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 2f261b0628faf..081c895c3175c 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -162,7 +162,7 @@ use slice;
 // `Iterator` is an enumeration with one type parameter and two variants,
 // which basically means it must be `Option`.
 
-/// The `Option` type.
+/// The `Option` type. See [the module level documentation](../index.html) for more.
 #[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Option {

From be97aab5d3dc26821b89fad92035f8b345221f4d Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Fri, 13 Feb 2015 11:24:19 -0800
Subject: [PATCH 26/54] Update version number for 1.0.0-alpha.2

---
 mk/main.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mk/main.mk b/mk/main.mk
index a6b201a2b7bdf..80db915c6f907 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.0.0
 # An optional number to put after the label, e.g. '.2' -> '-beta.2'
 # NB Make sure it starts with a dot to conform to semver pre-release
 # versions (section 9)
-CFG_PRERELEASE_VERSION=.1
+CFG_PRERELEASE_VERSION=.2
 
 CFG_FILENAME_EXTRA=4e7c5e5c
 
@@ -30,8 +30,8 @@ CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
 CFG_DISABLE_UNSTABLE_FEATURES=1
 endif
 ifeq ($(CFG_RELEASE_CHANNEL),beta)
-CFG_RELEASE=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
-CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta$(CFG_PRERELEASE_VERSION)
+CFG_RELEASE=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION)
+CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION)
 CFG_DISABLE_UNSTABLE_FEATURES=1
 endif
 ifeq ($(CFG_RELEASE_CHANNEL),nightly)

From 6647d8306e01713d2da1de4c20946773f6289b57 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 14:36:16 -0500
Subject: [PATCH 27/54] Mention type placeholders in the book.

Fixes #12891.
---
 src/doc/trpl/iterators.md | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/doc/trpl/iterators.md b/src/doc/trpl/iterators.md
index 75b3f8b06fc3b..738a28b428adf 100644
--- a/src/doc/trpl/iterators.md
+++ b/src/doc/trpl/iterators.md
@@ -132,7 +132,16 @@ let one_to_one_hundred = range(1, 101).collect::>();
 ```
 
 If you remember, the `::<>` syntax allows us to give a type hint,
-and so we tell it that we want a vector of integers.
+and so we tell it that we want a vector of integers. You don't always
+need to use the whole type, though. Using a `_` will let you provide
+a partial hint:
+
+```rust
+let one_to_one_hundred = range(1, 101).collect::>();
+```
+
+This says "Collect into a `Vec`, please, but infer what the `T` is for me."
+`_` is sometimes called a "type placeholder" for this reason.
 
 `collect()` is the most common consumer, but there are others too. `find()`
 is one:

From ece19bfc70b3742ebb8a2470accca7af96c5bc9a Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 14:57:55 -0500
Subject: [PATCH 28/54] Enhance static mut example in FFI chapter.

Fixes #9980
---
 src/doc/trpl/ffi.md | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md
index 640f9cc388ef0..5375a8aa46b30 100644
--- a/src/doc/trpl/ffi.md
+++ b/src/doc/trpl/ffi.md
@@ -420,7 +420,7 @@ fn main() {
 ```
 
 Alternatively, you may need to alter global state provided by a foreign
-interface. To do this, statics can be declared with `mut` so rust can mutate
+interface. To do this, statics can be declared with `mut` so we can mutate
 them.
 
 ```no_run
@@ -436,12 +436,19 @@ extern {
 
 fn main() {
     let prompt = CString::from_slice(b"[my-awesome-shell] $");
-    unsafe { rl_prompt = prompt.as_ptr(); }
-    // get a line, process it
-    unsafe { rl_prompt = ptr::null(); }
+    unsafe { 
+        rl_prompt = prompt.as_ptr();
+
+        println!("{}", rl_prompt);
+
+        rl_prompt = ptr::null();
+    }
 }
 ```
 
+Note that all interaction with a `static mut` is unsafe, both reading and
+writing. Dealing with global mutable state requires a great deal of care.
+
 # Foreign calling conventions
 
 Most foreign code exposes a C ABI, and Rust uses the platform's C calling convention by default when

From 5284c4ea6363ce27c09b00690e8dfcf1de80d139 Mon Sep 17 00:00:00 2001
From: Simonas Kazlauskas 
Date: Fri, 13 Feb 2015 15:03:15 +0200
Subject: [PATCH 29/54] Remove a few uses of deprecated getenv

---
 src/librustc_back/target/mod.rs |  3 +--
 src/libstd/sync/mpsc/mod.rs     | 16 ++++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 4d90c492fa240..b80a486b191d2 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -384,8 +384,7 @@ impl Target {
             Path::new(target)
         };
 
-        let target_path = env::var_os("RUST_TARGET_PATH")
-                              .unwrap_or(OsString::from_str(""));
+        let target_path = env::var_os("RUST_TARGET_PATH").unwrap_or(OsString::from_str(""));
 
         // FIXME 16351: add a sane default search path?
 
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index 2e60d684d6823..d783acd57ac04 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -1024,14 +1024,14 @@ impl fmt::Display for TryRecvError {
 mod test {
     use prelude::v1::*;
 
-    use os;
+    use std::env;
     use super::*;
     use thread::Thread;
 
     pub fn stress_factor() -> uint {
-        match os::getenv("RUST_TEST_STRESS") {
-            Some(val) => val.parse().unwrap(),
-            None => 1,
+        match env::var("RUST_TEST_STRESS") {
+            Ok(val) => val.parse().unwrap(),
+            Err(..) => 1,
         }
     }
 
@@ -1546,14 +1546,14 @@ mod test {
 mod sync_tests {
     use prelude::v1::*;
 
-    use os;
+    use std::env;
     use thread::Thread;
     use super::*;
 
     pub fn stress_factor() -> uint {
-        match os::getenv("RUST_TEST_STRESS") {
-            Some(val) => val.parse().unwrap(),
-            None => 1,
+        match env::var("RUST_TEST_STRESS") {
+            Ok(val) => val.parse().unwrap(),
+            Err(..) => 1,
         }
     }
 

From 220bf41d252048310632bc357eb2de2cc2e62e8c Mon Sep 17 00:00:00 2001
From: Simonas Kazlauskas 
Date: Fri, 13 Feb 2015 22:08:05 +0200
Subject: [PATCH 30/54] Cleanup getenv from tests and benchmarks

---
 src/test/bench/core-std.rs                     |  3 ++-
 src/test/bench/core-uint-to-str.rs             |  3 ++-
 src/test/bench/msgsend-pipes-shared.rs         |  3 ++-
 src/test/bench/msgsend-pipes.rs                |  3 ++-
 src/test/bench/msgsend-ring-mutex-arcs.rs      |  3 ++-
 src/test/bench/shootout-ackermann.rs           |  3 ++-
 src/test/bench/shootout-binarytrees.rs         |  2 +-
 src/test/bench/shootout-chameneos-redux.rs     |  2 +-
 src/test/bench/shootout-fasta.rs               |  5 +++--
 src/test/bench/shootout-fibo.rs                |  3 ++-
 src/test/bench/shootout-k-nucleotide-pipes.rs  |  3 ++-
 src/test/bench/shootout-k-nucleotide.rs        |  2 +-
 src/test/bench/shootout-nbody.rs               |  2 +-
 src/test/bench/shootout-pfib.rs                |  3 ++-
 src/test/bench/shootout-spectralnorm.rs        |  3 ++-
 src/test/bench/shootout-threadring.rs          |  2 +-
 src/test/bench/std-smallintmap.rs              |  3 ++-
 src/test/bench/task-perf-alloc-unwind.rs       |  4 ++--
 src/test/bench/task-perf-jargon-metal-smoke.rs |  3 ++-
 src/test/bench/task-perf-spawnalot.rs          |  3 ++-
 src/test/run-pass/backtrace.rs                 |  3 ++-
 src/test/run-pass/exec-env.rs                  |  4 ++--
 src/test/run-pass/issue-15149.rs               |  3 ++-
 src/test/run-pass/process-remove-from-env.rs   | 10 +++++-----
 24 files changed, 47 insertions(+), 31 deletions(-)

diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs
index 991c08f60be7a..00f8feacff8ca 100644
--- a/src/test/bench/core-std.rs
+++ b/src/test/bench/core-std.rs
@@ -17,6 +17,7 @@ use std::old_io::File;
 use std::iter::repeat;
 use std::mem::swap;
 use std::os;
+use std::env;
 use std::rand::Rng;
 use std::rand;
 use std::str;
@@ -46,7 +47,7 @@ fn main() {
 fn maybe_run_test(argv: &[String], name: String, test: F) where F: FnOnce() {
     let mut run_test = false;
 
-    if os::getenv("RUST_BENCH").is_some() {
+    if env::var_os("RUST_BENCH").is_some() {
         run_test = true
     } else if argv.len() > 0 {
         run_test = argv.iter().any(|x| x == &"all".to_string()) || argv.iter().any(|x| x == &name)
diff --git a/src/test/bench/core-uint-to-str.rs b/src/test/bench/core-uint-to-str.rs
index 99d83d761df66..90cc222c3deba 100644
--- a/src/test/bench/core-uint-to-str.rs
+++ b/src/test/bench/core-uint-to-str.rs
@@ -9,10 +9,11 @@
 // except according to those terms.
 
 use std::os;
+use std::env;
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "10000000".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "100000".to_string())
diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs
index be42cb277f7a0..4e9c2fe99bd4a 100644
--- a/src/test/bench/msgsend-pipes-shared.rs
+++ b/src/test/bench/msgsend-pipes-shared.rs
@@ -20,6 +20,7 @@
 
 use std::sync::mpsc::{channel, Sender, Receiver};
 use std::os;
+use std::env;
 use std::thread::Thread;
 use std::time::Duration;
 
@@ -94,7 +95,7 @@ fn run(args: &[String]) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "1000000".to_string(), "10000".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "10000".to_string(), "4".to_string())
diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs
index d9eea02a1769b..2530e8bd90707 100644
--- a/src/test/bench/msgsend-pipes.rs
+++ b/src/test/bench/msgsend-pipes.rs
@@ -16,6 +16,7 @@
 
 use std::sync::mpsc::{channel, Sender, Receiver};
 use std::os;
+use std::env;
 use std::thread::Thread;
 use std::time::Duration;
 
@@ -101,7 +102,7 @@ fn run(args: &[String]) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "1000000".to_string(), "8".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "10000".to_string(), "4".to_string())
diff --git a/src/test/bench/msgsend-ring-mutex-arcs.rs b/src/test/bench/msgsend-ring-mutex-arcs.rs
index 5d17e3a460c49..a935a6b308646 100644
--- a/src/test/bench/msgsend-ring-mutex-arcs.rs
+++ b/src/test/bench/msgsend-ring-mutex-arcs.rs
@@ -19,6 +19,7 @@
 // ignore-lexer-test FIXME #15679
 
 use std::os;
+use std::env;
 use std::sync::{Arc, Future, Mutex, Condvar};
 use std::time::Duration;
 
@@ -64,7 +65,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "100".to_string(), "10000".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "10".to_string(), "100".to_string())
diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs
index e66fffd04e358..933c1c218c376 100644
--- a/src/test/bench/shootout-ackermann.rs
+++ b/src/test/bench/shootout-ackermann.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::os;
+use std::env;
 
 fn ack(m: int, n: int) -> int {
     if m == 0 {
@@ -24,7 +25,7 @@ fn ack(m: int, n: int) -> int {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "12".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "8".to_string())
diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs
index 38648b426f6cd..0311a1ac7c4e1 100644
--- a/src/test/bench/shootout-binarytrees.rs
+++ b/src/test/bench/shootout-binarytrees.rs
@@ -86,7 +86,7 @@ fn inner(depth: i32, iterations: i32) -> String {
 fn main() {
     let args = std::os::args();
     let args = args;
-    let n = if std::os::getenv("RUST_BENCH").is_some() {
+    let n = if std::env::var_os("RUST_BENCH").is_some() {
         17
     } else if args.len() <= 1u {
         8
diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs
index 30bbb3bc924db..628206986c518 100644
--- a/src/test/bench/shootout-chameneos-redux.rs
+++ b/src/test/bench/shootout-chameneos-redux.rs
@@ -227,7 +227,7 @@ fn rendezvous(nn: uint, set: Vec) {
 }
 
 fn main() {
-    let nn = if std::os::getenv("RUST_BENCH").is_some() {
+    let nn = if std::env::var_os("RUST_BENCH").is_some() {
         200000
     } else {
         std::os::args()
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 141e098745e7b..5bf0862e0a1d6 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -43,6 +43,7 @@ use std::old_io::{BufferedWriter, File};
 use std::old_io;
 use std::num::Float;
 use std::os;
+use std::env;
 
 const LINE_LENGTH: uint = 60;
 const IM: u32 = 139968;
@@ -105,7 +106,7 @@ fn make_fasta>(
 fn run(writer: &mut W) -> std::old_io::IoResult<()> {
     let args = os::args();
     let args = args;
-    let n = if os::getenv("RUST_BENCH").is_some() {
+    let n = if env::var_os("RUST_BENCH").is_some() {
         25000000
     } else if args.len() <= 1u {
         1000
@@ -143,7 +144,7 @@ fn run(writer: &mut W) -> std::old_io::IoResult<()> {
 }
 
 fn main() {
-    let res = if os::getenv("RUST_BENCH").is_some() {
+    let res = if env::var_os("RUST_BENCH").is_some() {
         let mut file = BufferedWriter::new(File::create(&Path::new("./shootout-fasta.data")));
         run(&mut file)
     } else {
diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs
index 36854728ebf20..6a062ba3980d6 100644
--- a/src/test/bench/shootout-fibo.rs
+++ b/src/test/bench/shootout-fibo.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::os;
+use std::env;
 
 fn fib(n: int) -> int {
     if n < 2 {
@@ -20,7 +21,7 @@ fn fib(n: int) -> int {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "40".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "30".to_string())
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index ed93594534cb4..3c96878179f3a 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -22,6 +22,7 @@ use std::mem::replace;
 use std::num::Float;
 use std::option;
 use std::os;
+use std::env;
 use std::sync::mpsc::{channel, Sender, Receiver};
 use std::thread::Thread;
 
@@ -148,7 +149,7 @@ fn make_sequence_processor(sz: uint,
 fn main() {
     use std::old_io::{stdio, MemReader, BufferedReader};
 
-    let rdr = if os::getenv("RUST_BENCH").is_some() {
+    let rdr = if env::var_os("RUST_BENCH").is_some() {
         let foo = include_bytes!("shootout-k-nucleotide.data");
         box MemReader::new(foo.to_vec()) as Box
     } else {
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index 74d2168797296..ca920b2fa821c 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -291,7 +291,7 @@ fn get_sequence(r: &mut R, key: &str) -> Vec {
 }
 
 fn main() {
-    let input = if std::os::getenv("RUST_BENCH").is_some() {
+    let input = if std::env::var_os("RUST_BENCH").is_some() {
         let fd = std::old_io::File::open(&Path::new("shootout-k-nucleotide.data"));
         get_sequence(&mut std::old_io::BufferedReader::new(fd), ">THREE")
     } else {
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index 71fe1c6affce3..7904657bece28 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -170,7 +170,7 @@ fn offset_momentum(bodies: &mut [Planet;N_BODIES]) {
 }
 
 fn main() {
-    let n = if std::os::getenv("RUST_BENCH").is_some() {
+    let n = if std::env::var_os("RUST_BENCH").is_some() {
         5000000
     } else {
         std::os::args().get(1)
diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs
index a1a9fbb471a47..9abc808f88770 100644
--- a/src/test/bench/shootout-pfib.rs
+++ b/src/test/bench/shootout-pfib.rs
@@ -22,6 +22,7 @@ extern crate getopts;
 
 use std::sync::mpsc::{channel, Sender};
 use std::os;
+use std::env;
 use std::result::Result::{Ok, Err};
 use std::thread::Thread;
 use std::time::Duration;
@@ -89,7 +90,7 @@ fn stress(num_tasks: int) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "20".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "8".to_string())
diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs
index 24e11887065c2..8356df8d8a184 100644
--- a/src/test/bench/shootout-spectralnorm.rs
+++ b/src/test/bench/shootout-spectralnorm.rs
@@ -48,12 +48,13 @@ use std::thread::Thread;
 use std::mem;
 use std::num::Float;
 use std::os;
+use std::env;
 use std::raw::Repr;
 use std::simd::f64x2;
 
 fn main() {
     let args = os::args();
-    let answer = spectralnorm(if os::getenv("RUST_BENCH").is_some() {
+    let answer = spectralnorm(if env::var_os("RUST_BENCH").is_some() {
         5500
     } else if args.len() < 2 {
         2000
diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs
index ebe8a0751c3b0..8614f94da89ea 100644
--- a/src/test/bench/shootout-threadring.rs
+++ b/src/test/bench/shootout-threadring.rs
@@ -65,7 +65,7 @@ fn roundtrip(id: i32, tx: Sender, rx: Receiver) {
 
 fn main() {
     let args = std::os::args();
-    let token = if std::os::getenv("RUST_BENCH").is_some() {
+    let token = if std::env::var_os("RUST_BENCH").is_some() {
         2000000
     } else {
         args.get(1).and_then(|arg| arg.parse().ok()).unwrap_or(1000)
diff --git a/src/test/bench/std-smallintmap.rs b/src/test/bench/std-smallintmap.rs
index 562b82a92a31c..e6948a1371c9e 100644
--- a/src/test/bench/std-smallintmap.rs
+++ b/src/test/bench/std-smallintmap.rs
@@ -12,6 +12,7 @@
 
 use std::collections::VecMap;
 use std::os;
+use std::env;
 use std::time::Duration;
 
 fn append_sequential(min: uint, max: uint, map: &mut VecMap) {
@@ -28,7 +29,7 @@ fn check_sequential(min: uint, max: uint, map: &VecMap) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "100000".to_string(), "100".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "10000".to_string(), "50".to_string())
diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs
index 216745ca11058..f09e64cb9c5ea 100644
--- a/src/test/bench/task-perf-alloc-unwind.rs
+++ b/src/test/bench/task-perf-alloc-unwind.rs
@@ -10,7 +10,7 @@
 
 #![feature(unsafe_destructor, box_syntax)]
 
-use std::os;
+use std::env;
 use std::thread::Thread;
 use std::time::Duration;
 
@@ -20,7 +20,7 @@ enum List {
 }
 
 fn main() {
-    let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
+    let (repeat, depth) = if env::var_os("RUST_BENCH").is_some() {
         (50, 1000)
     } else {
         (10, 10)
diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs
index 31a4ac3d045f8..9edb4201098d6 100644
--- a/src/test/bench/task-perf-jargon-metal-smoke.rs
+++ b/src/test/bench/task-perf-jargon-metal-smoke.rs
@@ -19,6 +19,7 @@
 
 use std::sync::mpsc::{channel, Sender};
 use std::os;
+use std::env;
 use std::thread::Thread;
 
 fn child_generation(gens_left: uint, tx: Sender<()>) {
@@ -39,7 +40,7 @@ fn child_generation(gens_left: uint, tx: Sender<()>) {
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "100000".to_string())
     } else if args.len() <= 1 {
         vec!("".to_string(), "100".to_string())
diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs
index e76fad9f1a445..279b3fa432a3c 100644
--- a/src/test/bench/task-perf-spawnalot.rs
+++ b/src/test/bench/task-perf-spawnalot.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 use std::os;
+use std::env;
 use std::thread::Thread;
 
 fn f(n: uint) {
@@ -23,7 +24,7 @@ fn g() { }
 
 fn main() {
     let args = os::args();
-    let args = if os::getenv("RUST_BENCH").is_some() {
+    let args = if env::var_os("RUST_BENCH").is_some() {
         vec!("".to_string(), "400".to_string())
     } else if args.len() <= 1u {
         vec!("".to_string(), "10".to_string())
diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs
index 2cb6cf99d662e..b1cb4d6e42c23 100644
--- a/src/test/run-pass/backtrace.rs
+++ b/src/test/run-pass/backtrace.rs
@@ -15,6 +15,7 @@
 #![feature(unsafe_destructor)]
 
 use std::os;
+use std::env;
 use std::old_io::process::Command;
 use std::str;
 use std::ops::{Drop, FnMut, FnOnce};
@@ -22,7 +23,7 @@ use std::ops::{Drop, FnMut, FnOnce};
 #[inline(never)]
 fn foo() {
     let _v = vec![1, 2, 3];
-    if os::getenv("IS_TEST").is_some() {
+    if env::var_os("IS_TEST").is_some() {
         panic!()
     }
 }
diff --git a/src/test/run-pass/exec-env.rs b/src/test/run-pass/exec-env.rs
index 8775cb6da2ed2..a71016fd88baa 100644
--- a/src/test/run-pass/exec-env.rs
+++ b/src/test/run-pass/exec-env.rs
@@ -10,8 +10,8 @@
 
 // exec-env:TEST_EXEC_ENV=22
 
-use std::os;
+use std::env;
 
 pub fn main() {
-    assert_eq!(os::getenv("TEST_EXEC_ENV"), Some("22".to_string()));
+    assert_eq!(env::var("TEST_EXEC_ENV"), Ok("22".to_string()));
 }
diff --git a/src/test/run-pass/issue-15149.rs b/src/test/run-pass/issue-15149.rs
index 30a3183c80856..aa45a8c5d5f7f 100644
--- a/src/test/run-pass/issue-15149.rs
+++ b/src/test/run-pass/issue-15149.rs
@@ -13,6 +13,7 @@
 use std::slice::SliceExt;
 use std::old_io::{Command, fs, USER_RWX};
 use std::os;
+use std::env;
 use std::old_path::BytesContainer;
 use std::rand::random;
 
@@ -45,7 +46,7 @@ fn test() {
     fs::copy(&my_path, &child_path).unwrap();
 
     // Append the new directory to our own PATH.
-    let mut path = os::split_paths(os::getenv("PATH").unwrap_or(String::new()));
+    let mut path = os::split_paths(env::var("PATH").ok().unwrap_or(String::new()));
     path.push(child_dir.clone());
     let path = os::join_paths(&path).unwrap();
 
diff --git a/src/test/run-pass/process-remove-from-env.rs b/src/test/run-pass/process-remove-from-env.rs
index 8b99e8a947cf5..9eb7d624c9921 100644
--- a/src/test/run-pass/process-remove-from-env.rs
+++ b/src/test/run-pass/process-remove-from-env.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 use std::old_io::Command;
-use std::os;
+use std::env;
 
 #[cfg(all(unix, not(target_os="android")))]
 pub fn env_cmd() -> Command {
@@ -31,17 +31,17 @@ pub fn env_cmd() -> Command {
 
 fn main() {
     // save original environment
-    let old_env = os::getenv("RUN_TEST_NEW_ENV");
+    let old_env = env::var_os("RUN_TEST_NEW_ENV");
 
-    os::setenv("RUN_TEST_NEW_ENV", "123");
+    env::set_var("RUN_TEST_NEW_ENV", "123");
 
     let mut cmd = env_cmd();
     cmd.env_remove("RUN_TEST_NEW_ENV");
 
     // restore original environment
     match old_env {
-        None => os::unsetenv("RUN_TEST_NEW_ENV"),
-        Some(val) => os::setenv("RUN_TEST_NEW_ENV", val)
+        None => env::remove_var("RUN_TEST_NEW_ENV"),
+        Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val)
     }
 
     let prog = cmd.spawn().unwrap();

From b19fda0ceb820af57f00976951dba95a3c0419aa Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup 
Date: Fri, 13 Feb 2015 21:20:16 +0100
Subject: [PATCH 31/54] Remove ExactSizeIterator from 64-bit ranges.

Fixes #22047

Range and Range may be longer than usize::MAX on 32-bit
platforms, and thus they cannot fulfill the protocol for
ExactSizeIterator. We don't want a nonobvious platform dependency in
basic iterator traits, so the trait impl is removed.

The logic of this change assumes that usize is at least 32-bit.

This is technically a breaking change; note that Range and
Range are always ExactSizeIterators.

[breaking-change]
---
 src/libcore/iter.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 7740cd6867cbd..06aba2cb08ef3 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -2676,9 +2676,9 @@ impl Iterator for ::ops::Range {
     }
 }
 
+// Ranges of u64 and i64 are excluded because they cannot guarantee having
+// a length <= usize::MAX, which is required by ExactSizeIterator.
 range_exact_iter_impl!(usize u8 u16 u32 isize i8 i16 i32);
-#[cfg(target_pointer_width = "64")]
-range_exact_iter_impl!(u64 i64);
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl DoubleEndedIterator for ::ops::Range {

From 228603d9d210d121599ca384d2a66a90ba4299e1 Mon Sep 17 00:00:00 2001
From: Keegan McAllister 
Date: Fri, 13 Feb 2015 12:52:33 -0800
Subject: [PATCH 32/54] Parse `pub` in the expansion of a method macro

Fixes #17436.
---
 src/libsyntax/ext/tt/macro_rules.rs          |  3 +-
 src/test/run-pass/pub-method-inside-macro.rs | 29 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 src/test/run-pass/pub-method-inside-macro.rs

diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index de61bdefa5de3..f322cf8bad09c 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -89,8 +89,7 @@ impl<'a> MacResult for ParserAnyMacro<'a> {
             match parser.token {
                 token::Eof => break,
                 _ => {
-                    let attrs = parser.parse_outer_attributes();
-                    ret.push(parser.parse_method(attrs, ast::Inherited))
+                    ret.push(parser.parse_method_with_outer_attributes());
                 }
             }
         }
diff --git a/src/test/run-pass/pub-method-inside-macro.rs b/src/test/run-pass/pub-method-inside-macro.rs
new file mode 100644
index 0000000000000..af2f217c1fbb2
--- /dev/null
+++ b/src/test/run-pass/pub-method-inside-macro.rs
@@ -0,0 +1,29 @@
+// 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.
+
+// Issue #17436
+
+mod bleh {
+    macro_rules! foo {
+        () => {
+            pub fn bar(&self) { }
+        }
+    }
+
+    pub struct S;
+
+    impl S {
+        foo!();
+    }
+}
+
+fn main() {
+    bleh::S.bar();
+}

From dcd4cef119dc2fdac43b86cfb3694756d8c23f9f Mon Sep 17 00:00:00 2001
From: Keegan McAllister 
Date: Thu, 12 Feb 2015 20:43:57 -0800
Subject: [PATCH 33/54] Forbid `pub mymacro!();`

It's not clear what this means, because a macro in item position can expand to
zero or more items.  For now we disallow it, which is technically a

    [breaking-change]

but is landing without an RFC.  The `pub` keyword previously had no effect,
which seems quite unintended.

Fixes #18317.
Fixes #14660.
---
 src/libsyntax/parse/parser.rs              | 18 ++++++++++++
 src/test/compile-fail/pub-item-macro.rs    | 28 ++++++++++++++++++
 src/test/compile-fail/pub-method-macro.rs  | 34 ++++++++++++++++++++++
 src/test/run-pass/pub-item-inside-macro.rs | 25 ++++++++++++++++
 4 files changed, 105 insertions(+)
 create mode 100644 src/test/compile-fail/pub-item-macro.rs
 create mode 100644 src/test/compile-fail/pub-method-macro.rs
 create mode 100644 src/test/run-pass/pub-item-inside-macro.rs

diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index fd2f0685cab83..b1d0922cc8415 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4621,6 +4621,17 @@ impl<'a> Parser<'a> {
         self.parse_method(attrs, visa)
     }
 
+    fn complain_if_pub_macro(&mut self, visa: Visibility, span: Span) {
+        match visa {
+            Public => {
+                self.span_err(span, "can't qualify macro invocation with `pub`");
+                self.span_help(span, "try adjusting the macro to put `pub` inside \
+                                      the invocation");
+            }
+            Inherited => (),
+        }
+    }
+
     /// Parse a method in a trait impl, starting with `attrs` attributes.
     pub fn parse_method(&mut self,
                         attrs: Vec,
@@ -4635,6 +4646,10 @@ impl<'a> Parser<'a> {
                 && (self.look_ahead(2, |t| *t == token::OpenDelim(token::Paren))
                     || self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace))) {
                 // method macro.
+
+                let last_span = self.last_span;
+                self.complain_if_pub_macro(visa, last_span);
+
                 let pth = self.parse_path(NoTypesAllowed);
                 self.expect(&token::Not);
 
@@ -5838,6 +5853,9 @@ impl<'a> Parser<'a> {
                     || self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace))) {
             // MACRO INVOCATION ITEM
 
+            let last_span = self.last_span;
+            self.complain_if_pub_macro(visibility, last_span);
+
             // item macro.
             let pth = self.parse_path(NoTypesAllowed);
             self.expect(&token::Not);
diff --git a/src/test/compile-fail/pub-item-macro.rs b/src/test/compile-fail/pub-item-macro.rs
new file mode 100644
index 0000000000000..8809e9a257ddb
--- /dev/null
+++ b/src/test/compile-fail/pub-item-macro.rs
@@ -0,0 +1,28 @@
+// 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.
+
+// Issue #14660
+
+macro_rules! priv_x { () => {
+    static x: u32 = 0;
+}}
+
+macro_rules! pub_x { () => {
+    pub priv_x!(); //~ ERROR can't qualify macro invocation with `pub`
+    //~^ HELP try adjusting the macro to put `pub` inside the invocation
+}}
+
+mod foo {
+    pub_x!();
+}
+
+fn main() {
+    let y: u32 = foo::x;
+}
diff --git a/src/test/compile-fail/pub-method-macro.rs b/src/test/compile-fail/pub-method-macro.rs
new file mode 100644
index 0000000000000..aa890550f1c48
--- /dev/null
+++ b/src/test/compile-fail/pub-method-macro.rs
@@ -0,0 +1,34 @@
+// 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.
+
+// Issue #18317
+
+mod bleh {
+    macro_rules! defn {
+        ($n:ident) => (
+            fn $n (&self) -> i32 {
+                println!("{}", stringify!($n));
+                1
+            }
+        )
+    }
+
+    #[derive(Copy)]
+    pub struct S;
+
+    impl S {
+        pub defn!(f); //~ ERROR can't qualify macro invocation with `pub`
+        //~^ HELP try adjusting the macro to put `pub` inside the invocation
+    }
+}
+
+fn main() {
+    bleh::S.f();
+}
diff --git a/src/test/run-pass/pub-item-inside-macro.rs b/src/test/run-pass/pub-item-inside-macro.rs
new file mode 100644
index 0000000000000..442eea13d6bac
--- /dev/null
+++ b/src/test/run-pass/pub-item-inside-macro.rs
@@ -0,0 +1,25 @@
+// 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.
+
+// Issue #14660
+
+mod bleh {
+    macro_rules! foo {
+        () => {
+            pub fn bar() { }
+        }
+    }
+
+    foo!();
+}
+
+fn main() {
+    bleh::bar();
+}

From effad62bc5d8a0733c60ebee5faf13c24e8ce148 Mon Sep 17 00:00:00 2001
From: Brian Anderson 
Date: Wed, 11 Feb 2015 16:48:16 -0800
Subject: [PATCH 34/54] Add the build date to the reported version. #21957

rustc --version says

```
rustc 1.0.0-dev (d0e82a68a 2015-02-05) (built 2015-02-11)
```
---
 mk/main.mk                 | 6 +++++-
 src/librustc_driver/lib.rs | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/mk/main.mk b/mk/main.mk
index a6b201a2b7bdf..ef3abebb88f47 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -61,13 +61,16 @@ SPACE :=
 SPACE +=
 ifneq ($(CFG_GIT),)
 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
-    CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
+    CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --date=short --pretty=format:'%cd')
     CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
     CFG_SHORT_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse --short=9 HEAD)
     CFG_VERSION += ($(CFG_SHORT_VER_HASH) $(CFG_VER_DATE))
 endif
 endif
 
+CFG_BUILD_DATE = $(shell date +%F)
+CFG_VERSION += (built $(CFG_BUILD_DATE))
+
 # Windows exe's need numeric versions - don't use anything but
 # numbers and dots here
 CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
@@ -317,6 +320,7 @@ endif
 ifdef CFG_VER_HASH
 export CFG_VER_HASH
 endif
+export CFG_BUILD_DATE
 export CFG_VERSION
 export CFG_VERSION_WIN
 export CFG_RELEASE
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 9193debbe4243..4e25033e9732e 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -276,6 +276,10 @@ pub fn commit_date_str() -> Option<&'static str> {
     option_env!("CFG_VER_DATE")
 }
 
+pub fn build_date_str() -> Option<&'static str> {
+    option_env!("CFG_BUILD_DATE")
+}
+
 /// Prints version information and returns None on success or an error
 /// message on panic.
 pub fn version(binary: &str, matches: &getopts::Matches) {
@@ -287,6 +291,7 @@ pub fn version(binary: &str, matches: &getopts::Matches) {
         println!("binary: {}", binary);
         println!("commit-hash: {}", unw(commit_hash_str()));
         println!("commit-date: {}", unw(commit_date_str()));
+        println!("build-date: {}", unw(build_date_str()));
         println!("host: {}", config::host_triple());
         println!("release: {}", unw(release_str()));
     }

From 3df82450aa217442a1526e6f3e70f2dd6eb2ff88 Mon Sep 17 00:00:00 2001
From: Jorge Aparicio 
Date: Fri, 13 Feb 2015 17:38:27 -0500
Subject: [PATCH 35/54] add test for #21909

closes #21909
---
 src/test/run-pass/issue-21909.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 src/test/run-pass/issue-21909.rs

diff --git a/src/test/run-pass/issue-21909.rs b/src/test/run-pass/issue-21909.rs
new file mode 100644
index 0000000000000..5bbc90b260639
--- /dev/null
+++ b/src/test/run-pass/issue-21909.rs
@@ -0,0 +1,18 @@
+// 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.
+
+trait A {}
+
+trait B {
+    type X;
+    type Y: A;
+}
+
+fn main () { }

From 148d90be99b13d5874fedf398a506a5171cbba88 Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 17:56:06 -0500
Subject: [PATCH 36/54] clarfiy reference with regards to the value of block
 expressions

Fixes #14849
---
 src/doc/reference.md | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/doc/reference.md b/src/doc/reference.md
index 9c51f6bad6fee..df702a1840f05 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -2701,9 +2701,19 @@ items can bring new names into scopes and declared items are in scope for only
 the block itself.
 
 A block will execute each statement sequentially, and then execute the
-expression (if given). If the final expression is omitted, the type and return
-value of the block are `()`, but if it is provided, the type and return value
-of the block are that of the expression itself.
+expression (if given). If the block ends in a statement, its value is `()`:
+
+```
+let x: () = { println!("Hello."); };
+```
+
+If it ends in an expression, its value and type are that of the expression:
+
+```
+let x: i32 = { println!("Hello."); 5 };
+
+assert_eq!(5, x);
+```
 
 ### Method-call expressions
 

From f64d91211fdf483bd199448e8baa272381ead48e Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 18:00:00 -0500
Subject: [PATCH 37/54] Generate grammar.html and link to it from the
 reference.

Fixes #19278
---
 mk/docs.mk           | 2 +-
 src/doc/reference.md | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mk/docs.mk b/mk/docs.mk
index 2a5a847d2a425..4c2c1243c65a4 100644
--- a/mk/docs.mk
+++ b/mk/docs.mk
@@ -27,7 +27,7 @@
 ######################################################################
 DOCS := index intro tutorial complement-bugreport \
     complement-lang-faq complement-design-faq complement-project-faq \
-    rustdoc reference
+    rustdoc reference grammar
 
 # Legacy guides, preserved for a while to reduce the number of 404s
 DOCS += guide-crates guide-error-handling guide-ffi guide-macros guide \
diff --git a/src/doc/reference.md b/src/doc/reference.md
index 9c51f6bad6fee..c0af6affe8fa6 100644
--- a/src/doc/reference.md
+++ b/src/doc/reference.md
@@ -5,9 +5,7 @@
 This document is the primary reference for the Rust programming language. It
 provides three kinds of material:
 
-  - Chapters that formally define the language grammar and, for each
-    construct, informally describe its semantics and give examples of its
-    use.
+  - Chapters that informally describe each language construct and their use.
   - Chapters that informally describe the memory model, concurrency model,
     runtime services, linkage model and debugging facilities.
   - Appendix chapters providing rationale and references to languages that
@@ -23,8 +21,11 @@ separately by extracting documentation attributes from their source code. Many
 of the features that one might expect to be language features are library
 features in Rust, so what you're looking for may be there, not here.
 
+You may also be interested in the [grammar].
+
 [book]: book/index.html
 [standard]: std/index.html
+[grammar]: grammar.html
 
 # Notation
 

From 6d2e3d4bc05cb53fc6d6424293af93fecb495b4b Mon Sep 17 00:00:00 2001
From: Steve Klabnik 
Date: Fri, 13 Feb 2015 17:52:46 -0500
Subject: [PATCH 38/54] Note that Vec is heap allocated.

Fixes #20948
---
 src/doc/trpl/arrays-vectors-and-slices.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/doc/trpl/arrays-vectors-and-slices.md b/src/doc/trpl/arrays-vectors-and-slices.md
index 2df769b3c2c67..d4e2ad5cd5f66 100644
--- a/src/doc/trpl/arrays-vectors-and-slices.md
+++ b/src/doc/trpl/arrays-vectors-and-slices.md
@@ -49,8 +49,8 @@ languages.
 
 A *vector* is a dynamic or "growable" array, implemented as the standard
 library type [`Vec`](../std/vec/) (we'll talk about what the `` means
-later). Vectors are to arrays what `String` is to `&str`. You can create them
-with the `vec!` macro:
+later). Vectors always allocate their data on the heap. Vectors are to slices 
+what `String` is to `&str`. You can create them with the `vec!` macro:
 
 ```{rust}
 let v = vec![1, 2, 3]; // v: Vec

From 5e3ae102dbeeb646e8c7d2d423cea263337a76af Mon Sep 17 00:00:00 2001
From: Huon Wilson 
Date: Thu, 12 Feb 2015 22:50:44 +1100
Subject: [PATCH 39/54] Dramatically expand the docs of std::raw.

This overhauls the very meager docs that currently exist to clarify
various understandable confusions that I've noticed, e.g. people look in
`std::raw` for the "real" types of slices like `&[T]`, or think that
`Slice` refers to `[T]` (fixes #22214).

This patch takes the liberty of offering some "style" guidance around
`raw::Slice`, since there's more restricted ways to duplicate all
functionality connected to it: `std::slice::from_raw_parts{,_mut}` for
construction and `.as_{,mut_}ptr` & `.len` for deconstruction.

It also deprecates the `std::raw::Closure` type which is now useless for
non-type-erased closures, and replaced by `TraitObject` for `&Fn`, `&mut
FnMut` etc, so I guess it should be called a:

[breaking-change]
---
 src/libcore/raw.rs | 113 +++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 108 insertions(+), 5 deletions(-)

diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs
index 3fd244b46e30f..81edfe7d6e268 100644
--- a/src/libcore/raw.rs
+++ b/src/libcore/raw.rs
@@ -21,7 +21,40 @@
 use marker::Copy;
 use mem;
 
-/// The representation of a Rust slice
+/// The representation of a slice like `&[T]`.
+///
+/// This struct is guaranteed to have the layout of types like `&[T]`,
+/// `&str`, and `Box<[T]>`, but is not the type of such slices
+/// (e.g. the fields are not directly accessible on a `&[T]`) nor does
+/// it control that layout (changing the definition will not change
+/// the layout of a `&[T]`). It is only designed to be used by unsafe
+/// code that needs to manipulate the low-level details.
+///
+/// However, it is not recommended to use this type for such code,
+/// since there are alternatives which may be safer:
+///
+/// - Creating a slice from a data pointer and length can be done with
+///   `std::slice::from_raw_parts` or `std::slice::from_raw_parts_mut`
+///   instead of `std::mem::transmute`ing a value of type `Slice`.
+/// - Extracting the data pointer and length from a slice can be
+///   performed with the `as_ptr` (or `as_mut_ptr`) and `len`
+///   methods.
+///
+/// If one does decide to convert a slice value to a `Slice`, the
+/// `Repr` trait in this module provides a method for a safe
+/// conversion from `&[T]` (and `&str`) to a `Slice`, more type-safe
+/// than a call to `transmute`.
+///
+/// # Examples
+///
+/// ```
+/// use std::raw::{self, Repr};
+///
+/// let slice: &[u16] = &[1, 2, 3, 4];
+///
+/// let repr: raw::Slice = slice.repr();
+/// println!("data pointer = {:?}, length = {}", repr.data, repr.len);
+/// ```
 #[repr(C)]
 pub struct Slice {
     pub data: *const T,
@@ -30,18 +63,88 @@ pub struct Slice {
 
 impl Copy for Slice {}
 
-/// The representation of a Rust closure
+/// The representation of an old closure.
 #[repr(C)]
 #[derive(Copy)]
+#[unstable(feature = "core")]
+#[deprecated(reason = "unboxed new closures do not have a universal representation; \
+                       `&Fn` (etc) trait objects should use `TraitObject` instead",
+             since= "1.0.0")]
 pub struct Closure {
     pub code: *mut (),
     pub env: *mut (),
 }
 
-/// The representation of a Rust trait object.
+/// The representation of a trait object like `&SomeTrait`.
+///
+/// This struct has the same layout as types like `&SomeTrait` and
+/// `Box`. The [Static and Dynamic Dispatch chapter of the
+/// Book][moreinfo] contains more details about the precise nature of
+/// these internals.
+///
+/// [moreinfo]: ../../book/static-and-dynamic-dispatch.html#representation
+///
+/// `TraitObject` is guaranteed to match layouts, but it is not the
+/// type of trait objects (e.g. the fields are not directly accessible
+/// on a `&SomeTrait`) nor does it control that layout (changing the
+/// definition will not change the layout of a `&SometTrait`). It is
+/// only designed to be used by unsafe code that needs to manipulate
+/// the low-level details.
+///
+/// There is no `Repr` implementation for `TraitObject` because there
+/// is no way to refer to all trait objects generically, so the only
+/// way to create values of this type is with functions like
+/// `std::mem::transmute`. Similarly, the only way to create a true
+/// trait object from a `TraitObject` value is with `transmute`.
+///
+/// Synthesizing a trait object with mismatched types—one where the
+/// vtable does not correspond to the type of the value to which the
+/// data pointer points—is highly likely to lead to undefined
+/// behaviour.
+///
+/// # Examples
+///
+/// ```
+/// use std::mem;
+/// use std::raw;
+///
+/// // an example trait
+/// trait Foo {
+///     fn bar(&self) -> i32;
+/// }
+/// impl Foo for i32 {
+///     fn bar(&self) -> i32 {
+///          *self + 1
+///     }
+/// }
+///
+/// let value: i32 = 123;
+///
+/// // let the compiler make a trait object
+/// let object: &Foo = &value;
+///
+/// // look at the raw representation
+/// let raw_object: raw::TraitObject = unsafe { mem::transmute(object) };
+///
+/// // the data pointer is the address of `value`
+/// assert_eq!(raw_object.data as *const i32, &value as *const _);
+///
+///
+/// let other_value: i32 = 456;
+///
+/// // construct a new object, pointing to a different `i32`, being
+/// // careful to use the `i32` vtable from `object`
+/// let synthesized: &Foo = unsafe {
+///      mem::transmute(raw::TraitObject {
+///          data: &other_value as *const _ as *mut (),
+///          vtable: raw_object.vtable
+///      })
+/// };
 ///
-/// This struct does not have a `Repr` implementation
-/// because there is no way to refer to all trait objects generically.
+/// // it should work just like we constructed a trait object out of
+/// // `other_value` directly
+/// assert_eq!(synthesized.bar(), 457);
+/// ```
 #[repr(C)]
 #[derive(Copy)]
 pub struct TraitObject {

From 7a52932f4cd65f57bcc8d77f12e32066b2a9c432 Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup 
Date: Fri, 13 Feb 2015 20:31:09 +0100
Subject: [PATCH 40/54] Make std::raw::Repr an unsafe trait

The default implementation of .repr() will call conveniently call
transmute_copy which should be appropriate for all implementors, but is
memory unsafe if used wrong.

Fixes #22260

You need to use `unsafe impl` to implement the Repr trait now.

[breaking-change]
---
 src/libcore/raw.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs
index 81edfe7d6e268..bb0c22d3561d2 100644
--- a/src/libcore/raw.rs
+++ b/src/libcore/raw.rs
@@ -154,7 +154,7 @@ pub struct TraitObject {
 
 /// This trait is meant to map equivalences between raw structs and their
 /// corresponding rust values.
-pub trait Repr {
+pub unsafe trait Repr {
     /// This function "unwraps" a rust value (without consuming it) into its raw
     /// struct representation. This can be used to read/write different values
     /// for the struct. This is a safe method because by default it does not
@@ -163,5 +163,5 @@ pub trait Repr {
     fn repr(&self) -> T { unsafe { mem::transmute_copy(&self) } }
 }
 
-impl Repr> for [T] {}
-impl Repr> for str {}
+unsafe impl Repr> for [T] {}
+unsafe impl Repr> for str {}

From 1c494046a51e2e75126a12d60a9e0a07153e9fd6 Mon Sep 17 00:00:00 2001
From: Alexis 
Date: Thu, 12 Feb 2015 17:11:08 -0500
Subject: [PATCH 41/54] allow DList to split_at . fixes #22244

---
 src/libcollections/dlist.rs | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs
index a080146e0ec50..abe206c391430 100644
--- a/src/libcollections/dlist.rs
+++ b/src/libcollections/dlist.rs
@@ -560,7 +560,12 @@ impl DList {
     /// Splits the list into two at the given index. Returns everything after the given index,
     /// including the index.
     ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    ///
     /// This operation should compute in O(n) time.
+    ///
     /// # Examples
     ///
     /// ```
@@ -580,9 +585,11 @@ impl DList {
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn split_off(&mut self, at: usize) -> DList {
         let len = self.len();
-        assert!(at < len, "Cannot split off at a nonexistent index");
+        assert!(at <= len, "Cannot split off at a nonexistent index");
         if at == 0 {
             return mem::replace(self, DList::new());
+        } else if at == len {
+            return DList::new();
         }
 
         // Below, we iterate towards the `i-1`th node, either from the start or the end,
@@ -1116,6 +1123,18 @@ mod tests {
             }
         }
 
+        // no-op on the last index
+        {
+            let mut m = DList::new();
+            m.push_back(1);
+
+            let p = m.split_off(1);
+            assert_eq!(m.len(), 1);
+            assert_eq!(p.len(), 0);
+            assert_eq!(m.back(), Some(&1));
+            assert_eq!(m.front(), Some(&1));
+        }
+
     }
 
     #[test]

From 1e01f7f470f1d79be710d546ab25426fcede59f9 Mon Sep 17 00:00:00 2001
From: Kevin Yap 
Date: Fri, 13 Feb 2015 19:59:53 -0800
Subject: [PATCH 42/54] Rename std::failure to std::panicking

Closes #22306.
---
 src/libstd/lib.rs                       | 2 +-
 src/libstd/old_io/stdio.rs              | 2 +-
 src/libstd/{failure.rs => panicking.rs} | 2 +-
 src/libstd/rt/unwind.rs                 | 6 +++---
 4 files changed, 6 insertions(+), 6 deletions(-)
 rename src/libstd/{failure.rs => panicking.rs} (97%)

diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 83f0b7bc0e92b..42eed5f4dbd74 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -278,7 +278,7 @@ pub mod sync;
 #[path = "sys/common/mod.rs"] mod sys_common;
 
 pub mod rt;
-mod failure;
+mod panicking;
 
 // Documentation for primitive types
 
diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs
index 8e55251d285b5..70cce1f7e769e 100644
--- a/src/libstd/old_io/stdio.rs
+++ b/src/libstd/old_io/stdio.rs
@@ -30,7 +30,7 @@ use self::StdSource::*;
 use boxed::Box;
 use cell::RefCell;
 use clone::Clone;
-use failure::LOCAL_STDERR;
+use panicking::LOCAL_STDERR;
 use fmt;
 use old_io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer,
          standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
diff --git a/src/libstd/failure.rs b/src/libstd/panicking.rs
similarity index 97%
rename from src/libstd/failure.rs
rename to src/libstd/panicking.rs
index c184d3f4661f1..e485c6a63c6f1 100644
--- a/src/libstd/failure.rs
+++ b/src/libstd/panicking.rs
@@ -33,7 +33,7 @@ impl Writer for Stdio {
     }
 }
 
-pub fn on_fail(obj: &(Any+Send), file: &'static str, line: uint) {
+pub fn on_panic(obj: &(Any+Send), file: &'static str, line: uint) {
     let msg = match obj.downcast_ref::<&'static str>() {
         Some(s) => *s,
         None => match obj.downcast_ref::() {
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 659e787a9ff8f..464adadde6215 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -62,7 +62,7 @@ use prelude::v1::*;
 use any::Any;
 use cell::Cell;
 use cmp;
-use failure;
+use panicking;
 use fmt;
 use intrinsics;
 use libc::c_void;
@@ -534,10 +534,10 @@ pub fn begin_unwind(msg: M, file_line: &(&'static str, uint)) ->
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
 fn begin_unwind_inner(msg: Box, file_line: &(&'static str, uint)) -> ! {
-    // Make sure the default failure handler is registered before we look at the
+    // Make sure the default panic handler is registered before we look at the
     // callbacks.
     static INIT: Once = ONCE_INIT;
-    INIT.call_once(|| unsafe { register(failure::on_fail); });
+    INIT.call_once(|| unsafe { register(panicking::on_panic); });
 
     // First, invoke call the user-defined callbacks triggered on thread panic.
     //

From 10dd8e721e0682de31006ca311400819b634771e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jorge=20Israel=20Pe=C3=B1a?= 
Date: Sat, 14 Feb 2015 02:43:36 -0800
Subject: [PATCH 43/54] we forgot to make `Path` implement `Hash`

`PathBuf` does implement `Hash`, but `Path` doesn't. This makes it
annoying if you have a `HashMap` with `PathBuf`s as keys, because
it means you have to convert a `Path` into a `PathBuf` and get a
reference to it simply to perform operations on the `HashMap`!
---
 src/libstd/path.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 271a4cdb629b3..1f6d39fb1b3f4 100755
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1033,6 +1033,7 @@ impl AsOsStr for PathBuf {
 /// let parent_dir = path.parent();
 /// ```
 ///
+#[derive(Hash)]
 pub struct Path {
     inner: OsStr
 }

From 657081bc9c42eb48aa938f3c40f0b30f69e31aa5 Mon Sep 17 00:00:00 2001
From: Manish Goregaokar 
Date: Sat, 14 Feb 2015 16:28:18 +0530
Subject: [PATCH 44/54] Normalize range syntax used in concurrency.md

(fixes #22317)
---
 src/doc/trpl/concurrency.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/doc/trpl/concurrency.md b/src/doc/trpl/concurrency.md
index 800b5a2ad9768..3c933c1c5af58 100644
--- a/src/doc/trpl/concurrency.md
+++ b/src/doc/trpl/concurrency.md
@@ -171,7 +171,7 @@ use std::time::Duration;
 fn main() {
     let mut data = vec![1u32, 2, 3];
 
-    for i in 0 .. 2 {
+    for i in 0..2 {
         Thread::spawn(move || {
             data[i] += 1;
         });
@@ -211,7 +211,7 @@ use std::sync::Mutex;
 fn main() {
     let mut data = Mutex::new(vec![1u32, 2, 3]);
 
-    for i in 0 .. 2 {
+    for i in 0..2 {
         let data = data.lock().unwrap();
         Thread::spawn(move || {
             data[i] += 1;
@@ -262,7 +262,7 @@ use std::time::Duration;
 fn main() {
     let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
 
-    for i in (0us..2) {
+    for i in 0us..2 {
         let data = data.clone();
         Thread::spawn(move || {
             let mut data = data.lock().unwrap();
@@ -285,7 +285,7 @@ thread more closely:
 # use std::time::Duration;
 # fn main() {
 #     let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
-#     for i in (0us..2) {
+#     for i in 0us..2 {
 #         let data = data.clone();
 Thread::spawn(move || {
     let mut data = data.lock().unwrap();
@@ -323,7 +323,7 @@ fn main() {
 
     let (tx, rx) = mpsc::channel();
 
-    for _ in (0..10) {
+    for _ in 0..10 {
         let (data, tx) = (data.clone(), tx.clone());
 
         Thread::spawn(move || {
@@ -334,7 +334,7 @@ fn main() {
         });
     }
 
-    for _ in 0 .. 10 {
+    for _ in 0..10 {
         rx.recv();
     }
 }

From af7b8910b814f5f8ed58d0f692360c9bb7ee4ab9 Mon Sep 17 00:00:00 2001
From: Jake Goulding 
Date: Sat, 14 Feb 2015 09:09:07 -0500
Subject: [PATCH 45/54] Correct typo

---
 src/libstd/ffi/os_str.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 4d7292b6eb417..1d14b141778f0 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -189,7 +189,7 @@ impl OsStr {
         self.inner.to_string_lossy()
     }
 
-    /// Copy the slice into an onwed `OsString`.
+    /// Copy the slice into an owned `OsString`.
     pub fn to_os_string(&self) -> OsString {
         OsString { inner: self.inner.to_owned() }
     }

From f658efe6c3659fdf1338bea6a05e02acbda1ce14 Mon Sep 17 00:00:00 2001
From: Thiago Carvalho 
Date: Sat, 14 Feb 2015 16:55:53 +0100
Subject: [PATCH 46/54] Documentation Fixes

crates-and-modules - replace ")"
more string - improve readability of grapheme
---
 src/doc/trpl/crates-and-modules.md | 2 +-
 src/doc/trpl/more-strings.md       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/doc/trpl/crates-and-modules.md b/src/doc/trpl/crates-and-modules.md
index 17b2cf7d0cc25..1f5d3eadae3b9 100644
--- a/src/doc/trpl/crates-and-modules.md
+++ b/src/doc/trpl/crates-and-modules.md
@@ -20,7 +20,7 @@ you to partition your code within the crate itself.
 
 As an example, let's make a *phrases* crate, which will give us various phrases
 in different languages. To keep things simple, we'll stick to "greetings" and
-"farewells" as two kinds of phrases, and use English and Japanese (日本語) as
+"farewells" as two kinds of phrases, and use English and Japanese (日本語) as
 two languages for those phrases to be in. We'll use this module layout:
 
 ```text
diff --git a/src/doc/trpl/more-strings.md b/src/doc/trpl/more-strings.md
index 986ad23c665a7..df73d14f9836d 100644
--- a/src/doc/trpl/more-strings.md
+++ b/src/doc/trpl/more-strings.md
@@ -169,8 +169,8 @@ é
 Note that `l` has the type `&str` here, since a single grapheme can consist of
 multiple codepoints, so a `char` wouldn't be appropriate.
 
-This will print out each visible character in turn, as you'd expect: first "u͔", then
-"n͈̰̎", etc. If you wanted each individual codepoint of each grapheme, you can use `.chars()`:
+This will print out each visible character in turn, as you'd expect: first `u͔`, then
+`n͈̰̎`, etc. If you wanted each individual codepoint of each grapheme, you can use `.chars()`:
 
 ```
 let s = "u͔n͈̰̎i̙̮͚̦c͚̉o̼̩̰͗d͔̆̓ͥé";

From 09f53fd45c14a9fb796eca54a8954e943bf09477 Mon Sep 17 00:00:00 2001
From: Vadim Petrochenkov 
Date: Sun, 15 Feb 2015 00:09:40 +0300
Subject: [PATCH 47/54] Audit integer types in libunicode, libcore/(char, str)
 and libstd/ascii

---
 src/etc/unicode.py       |  10 +--
 src/libcore/char.rs      |  42 +++++------
 src/libcore/str/mod.rs   | 156 ++++++++++++++++++++-------------------
 src/libstd/ascii.rs      |   4 +-
 src/libunicode/lib.rs    |   1 -
 src/libunicode/tables.rs |  10 +--
 src/libunicode/u_char.rs |  28 +++----
 src/libunicode/u_str.rs  |  30 ++++----
 8 files changed, 141 insertions(+), 140 deletions(-)

diff --git a/src/etc/unicode.py b/src/etc/unicode.py
index 4952b99ab464e..dc8716d1378df 100755
--- a/src/etc/unicode.py
+++ b/src/etc/unicode.py
@@ -366,7 +366,7 @@ def emit_conversions_module(f, lowerupper, upperlower):
         }
     }
 
-    fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option {
+    fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option {
         match table.binary_search(|&(key, _)| {
             if c == key { Equal }
             else if key < c { Less }
@@ -449,13 +449,13 @@ def emit_charwidth_module(f, width_table):
 """)
 
     f.write("""
-    pub fn width(c: char, is_cjk: bool) -> Option {
-        match c as uint {
+    pub fn width(c: char, is_cjk: bool) -> Option {
+        match c as usize {
             _c @ 0 => Some(0),          // null is zero width
             cu if cu < 0x20 => None,    // control sequences have no width
             cu if cu < 0x7F => Some(1), // ASCII
             cu if cu < 0xA0 => None,    // more control sequences
-            _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as uint)
+            _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as usize)
         }
     }
 
@@ -610,7 +610,7 @@ def optimize_width_table(wtable):
         rf.write("""
 /// The version of [Unicode](http://www.unicode.org/)
 /// that the `UnicodeChar` and `UnicodeStrPrelude` traits are based on.
-pub const UNICODE_VERSION: (uint, uint, uint) = (%s, %s, %s);
+pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
 """ % unicode_version)
         (canon_decomp, compat_decomp, gencats, combines,
                 lowerupper, upperlower) = load_unicode_data("UnicodeData.txt")
diff --git a/src/libcore/char.rs b/src/libcore/char.rs
index 28e0247f00a25..683e450acb230 100644
--- a/src/libcore/char.rs
+++ b/src/libcore/char.rs
@@ -119,16 +119,16 @@ pub fn from_u32(i: u32) -> Option {
 /// ```
 #[inline]
 #[unstable(feature = "core", reason = "pending integer conventions")]
-pub fn from_digit(num: uint, radix: uint) -> Option {
+pub fn from_digit(num: u32, radix: u32) -> Option {
     if radix > 36 {
         panic!("from_digit: radix is too high (maximum 36)");
     }
     if num < radix {
         unsafe {
             if num < 10 {
-                Some(transmute(('0' as uint + num) as u32))
+                Some(transmute('0' as u32 + num))
             } else {
-                Some(transmute(('a' as uint + num - 10) as u32))
+                Some(transmute('a' as u32 + num - 10))
             }
         }
     } else {
@@ -164,7 +164,7 @@ pub trait CharExt {
     /// ```
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn is_digit(self, radix: uint) -> bool;
+    fn is_digit(self, radix: u32) -> bool;
 
     /// Converts a character to the corresponding digit.
     ///
@@ -189,7 +189,7 @@ pub trait CharExt {
     /// ```
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn to_digit(self, radix: uint) -> Option;
+    fn to_digit(self, radix: u32) -> Option;
 
     /// Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s.
     ///
@@ -275,7 +275,7 @@ pub trait CharExt {
     /// assert_eq!(n, 2);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf8(self) -> uint;
+    fn len_utf8(self) -> usize;
 
     /// Returns the number of bytes this character would need if encoded in UTF-16.
     ///
@@ -287,7 +287,7 @@ pub trait CharExt {
     /// assert_eq!(n, 1);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf16(self) -> uint;
+    fn len_utf16(self) -> usize;
 
     /// Encodes this character as UTF-8 into the provided byte buffer, and then returns the number
     /// of bytes written.
@@ -317,7 +317,7 @@ pub trait CharExt {
     /// assert_eq!(result, None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn encode_utf8(self, dst: &mut [u8]) -> Option;
+    fn encode_utf8(self, dst: &mut [u8]) -> Option;
 
     /// Encodes this character as UTF-16 into the provided `u16` buffer, and then returns the
     /// number of `u16`s written.
@@ -347,27 +347,27 @@ pub trait CharExt {
     /// assert_eq!(result, None);
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn encode_utf16(self, dst: &mut [u16]) -> Option;
+    fn encode_utf16(self, dst: &mut [u16]) -> Option;
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl CharExt for char {
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn is_digit(self, radix: uint) -> bool {
+    fn is_digit(self, radix: u32) -> bool {
         self.to_digit(radix).is_some()
     }
 
     #[unstable(feature = "core",
                reason = "pending integer conventions")]
-    fn to_digit(self, radix: uint) -> Option {
+    fn to_digit(self, radix: u32) -> Option {
         if radix > 36 {
             panic!("to_digit: radix is too high (maximum 36)");
         }
         let val = match self {
-          '0' ... '9' => self as uint - ('0' as uint),
-          'a' ... 'z' => self as uint + 10 - ('a' as uint),
-          'A' ... 'Z' => self as uint + 10 - ('A' as uint),
+          '0' ... '9' => self as u32 - '0' as u32,
+          'a' ... 'z' => self as u32 - 'a' as u32 + 10,
+          'A' ... 'Z' => self as u32 - 'A' as u32 + 10,
           _ => return None,
         };
         if val < radix { Some(val) }
@@ -396,7 +396,7 @@ impl CharExt for char {
 
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf8(self) -> uint {
+    fn len_utf8(self) -> usize {
         let code = self as u32;
         match () {
             _ if code < MAX_ONE_B   => 1,
@@ -408,7 +408,7 @@ impl CharExt for char {
 
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn len_utf16(self) -> uint {
+    fn len_utf16(self) -> usize {
         let ch = self as u32;
         if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
     }
@@ -416,14 +416,14 @@ impl CharExt for char {
     #[inline]
     #[unstable(feature = "core",
                reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf8(self, dst: &mut [u8]) -> Option {
+    fn encode_utf8(self, dst: &mut [u8]) -> Option {
         encode_utf8_raw(self as u32, dst)
     }
 
     #[inline]
     #[unstable(feature = "core",
                reason = "pending decision about Iterator/Writer/Reader")]
-    fn encode_utf16(self, dst: &mut [u16]) -> Option {
+    fn encode_utf16(self, dst: &mut [u16]) -> Option {
         encode_utf16_raw(self as u32, dst)
     }
 }
@@ -435,7 +435,7 @@ impl CharExt for char {
 /// and a `None` will be returned.
 #[inline]
 #[unstable(feature = "core")]
-pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option {
+pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option {
     // Marked #[inline] to allow llvm optimizing it away
     if code < MAX_ONE_B && dst.len() >= 1 {
         dst[0] = code as u8;
@@ -467,7 +467,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option {
 /// and a `None` will be returned.
 #[inline]
 #[unstable(feature = "core")]
-pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option {
+pub fn encode_utf16_raw(mut ch: u32, dst: &mut [u16]) -> Option {
     // Marked #[inline] to allow llvm optimizing it away
     if (ch & 0xFFFF_u32) == ch  && dst.len() >= 1 {
         // The BMP falls through (assuming non-surrogate, as it should)
@@ -499,7 +499,7 @@ enum EscapeUnicodeState {
     Backslash,
     Type,
     LeftBrace,
-    Value(uint),
+    Value(usize),
     RightBrace,
     Done,
 }
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 747152a824496..ce26abe606dd4 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -41,7 +41,7 @@ macro_rules! delegate_iter {
         delegate_iter!{$te : $ti}
         impl<'a> ExactSizeIterator for $ti {
             #[inline]
-            fn len(&self) -> uint {
+            fn len(&self) -> usize {
                 self.0.len()
             }
         }
@@ -56,7 +56,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option) {
+            fn size_hint(&self) -> (usize, Option) {
                 self.0.size_hint()
             }
         }
@@ -78,7 +78,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option) {
+            fn size_hint(&self) -> (usize, Option) {
                 self.0.size_hint()
             }
         }
@@ -100,7 +100,7 @@ macro_rules! delegate_iter {
                 self.0.next()
             }
             #[inline]
-            fn size_hint(&self) -> (uint, Option) {
+            fn size_hint(&self) -> (usize, Option) {
                 self.0.size_hint()
             }
         }
@@ -178,7 +178,7 @@ pub enum Utf8Error {
     /// The offset is guaranteed to be in bounds of the slice in question, and
     /// the byte at the specified offset was the first invalid byte in the
     /// sequence detected.
-    InvalidByte(uint),
+    InvalidByte(usize),
 
     /// The byte slice was invalid because more bytes were needed but no more
     /// bytes were available.
@@ -227,7 +227,7 @@ pub unsafe fn from_utf8_unchecked<'a>(v: &'a [u8]) -> &'a str {
 pub unsafe fn from_c_str(s: *const i8) -> &'static str {
     let s = s as *const u8;
     let mut len = 0;
-    while *s.offset(len as int) != 0 {
+    while *s.offset(len as isize) != 0 {
         len += 1;
     }
     let v: &'static [u8] = ::mem::transmute(Slice { data: s, len: len });
@@ -250,7 +250,7 @@ impl CharEq for char {
     fn matches(&mut self, c: char) -> bool { *self == c }
 
     #[inline]
-    fn only_ascii(&self) -> bool { (*self as uint) < 128 }
+    fn only_ascii(&self) -> bool { (*self as u32) < 128 }
 }
 
 impl CharEq for F where F: FnMut(char) -> bool {
@@ -383,7 +383,7 @@ impl<'a> Iterator for Chars<'a> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option) {
+    fn size_hint(&self) -> (usize, Option) {
         let (len, _) = self.iter.size_hint();
         (len.saturating_add(3) / 4, Some(len))
     }
@@ -428,16 +428,16 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
 #[derive(Clone)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct CharIndices<'a> {
-    front_offset: uint,
+    front_offset: usize,
     iter: Chars<'a>,
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for CharIndices<'a> {
-    type Item = (uint, char);
+    type Item = (usize, char);
 
     #[inline]
-    fn next(&mut self) -> Option<(uint, char)> {
+    fn next(&mut self) -> Option<(usize, char)> {
         let (pre_len, _) = self.iter.iter.size_hint();
         match self.iter.next() {
             None => None,
@@ -451,7 +451,7 @@ impl<'a> Iterator for CharIndices<'a> {
     }
 
     #[inline]
-    fn size_hint(&self) -> (uint, Option) {
+    fn size_hint(&self) -> (usize, Option) {
         self.iter.size_hint()
     }
 }
@@ -459,7 +459,7 @@ impl<'a> Iterator for CharIndices<'a> {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> DoubleEndedIterator for CharIndices<'a> {
     #[inline]
-    fn next_back(&mut self) -> Option<(uint, char)> {
+    fn next_back(&mut self) -> Option<(usize, char)> {
         match self.iter.next_back() {
             None => None,
             Some(ch) => {
@@ -512,7 +512,7 @@ struct CharSplits<'a, Sep> {
 struct CharSplitsN<'a, Sep> {
     iter: CharSplits<'a, Sep>,
     /// The number of splits remaining
-    count: uint,
+    count: usize,
     invert: bool,
 }
 
@@ -636,7 +636,7 @@ impl<'a, Sep: CharEq> Iterator for CharSplitsN<'a, Sep> {
 /// within a larger string using naive search
 #[derive(Clone)]
 struct NaiveSearcher {
-    position: uint
+    position: usize
 }
 
 impl NaiveSearcher {
@@ -644,7 +644,7 @@ impl NaiveSearcher {
         NaiveSearcher { position: 0 }
     }
 
-    fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(uint, uint)> {
+    fn next(&mut self, haystack: &[u8], needle: &[u8]) -> Option<(usize, usize)> {
         while self.position + needle.len() <= haystack.len() {
             if &haystack[self.position .. self.position + needle.len()] == needle {
                 let match_pos = self.position;
@@ -663,13 +663,13 @@ impl NaiveSearcher {
 #[derive(Clone)]
 struct TwoWaySearcher {
     // constants
-    crit_pos: uint,
-    period: uint,
+    crit_pos: usize,
+    period: usize,
     byteset: u64,
 
     // variables
-    position: uint,
-    memory: uint
+    position: usize,
+    memory: usize
 }
 
 /*
@@ -756,7 +756,7 @@ impl TwoWaySearcher {
 
         // This isn't in the original algorithm, as far as I'm aware.
         let byteset = needle.iter()
-                            .fold(0, |a, &b| (1 << ((b & 0x3f) as uint)) | a);
+                            .fold(0, |a, &b| (1 << ((b & 0x3f) as usize)) | a);
 
         // A particularly readable explanation of what's going on here can be found
         // in Crochemore and Rytter's book "Text Algorithms", ch 13. Specifically
@@ -794,7 +794,8 @@ impl TwoWaySearcher {
     // How far we can jump when we encounter a mismatch is all based on the fact
     // that (u, v) is a critical factorization for the needle.
     #[inline]
-    fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool) -> Option<(uint, uint)> {
+    fn next(&mut self, haystack: &[u8], needle: &[u8], long_period: bool)
+            -> Option<(usize, usize)> {
         'search: loop {
             // Check that we have room to search in
             if self.position + needle.len() > haystack.len() {
@@ -804,7 +805,7 @@ impl TwoWaySearcher {
             // Quickly skip by large portions unrelated to our substring
             if (self.byteset >>
                     ((haystack[self.position + needle.len() - 1] & 0x3f)
-                     as uint)) & 1 == 0 {
+                     as usize)) & 1 == 0 {
                 self.position += needle.len();
                 if !long_period {
                     self.memory = 0;
@@ -851,7 +852,7 @@ impl TwoWaySearcher {
     // Specifically, returns (i, p), where i is the starting index of v in some
     // critical factorization (u, v) and p = period(v)
     #[inline]
-    fn maximal_suffix(arr: &[u8], reversed: bool) -> (uint, uint) {
+    fn maximal_suffix(arr: &[u8], reversed: bool) -> (usize, usize) {
         let mut left = -1; // Corresponds to i in the paper
         let mut right = 0; // Corresponds to j in the paper
         let mut offset = 1; // Corresponds to k in the paper
@@ -937,16 +938,16 @@ pub struct MatchIndices<'a> {
 #[unstable(feature = "core", reason = "type may be removed")]
 pub struct SplitStr<'a> {
     it: MatchIndices<'a>,
-    last_end: uint,
+    last_end: usize,
     finished: bool
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for MatchIndices<'a> {
-    type Item = (uint, uint);
+    type Item = (usize, usize);
 
     #[inline]
-    fn next(&mut self) -> Option<(uint, uint)> {
+    fn next(&mut self) -> Option<(usize, usize)> {
         match self.searcher {
             Naive(ref mut searcher)
                 => searcher.next(self.haystack.as_bytes(), self.needle.as_bytes()),
@@ -991,8 +992,9 @@ Section: Comparing strings
 /// to compare &[u8] byte slices that are not necessarily valid UTF-8.
 #[inline]
 fn eq_slice_(a: &str, b: &str) -> bool {
+    // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
     #[allow(improper_ctypes)]
-    extern { fn memcmp(s1: *const i8, s2: *const i8, n: uint) -> i32; }
+    extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
     a.len() == b.len() && unsafe {
         memcmp(a.as_ptr() as *const i8,
                b.as_ptr() as *const i8,
@@ -1049,7 +1051,7 @@ fn run_utf8_validation_iterator(iter: &mut slice::Iter)
         // ASCII characters are always valid, so only large
         // bytes need more examination.
         if first >= 128 {
-            let w = UTF8_CHAR_WIDTH[first as uint] as uint;
+            let w = UTF8_CHAR_WIDTH[first as usize] as usize;
             let second = next!();
             // 2-byte encoding is for codepoints  \u{0080} to  \u{07ff}
             //        first  C2 80        last DF BF
@@ -1124,7 +1126,7 @@ pub struct CharRange {
     /// Current `char`
     pub ch: char,
     /// Index of the first byte of the next `char`
-    pub next: uint,
+    pub next: usize,
 }
 
 /// Mask of the value bits of a continuation byte
@@ -1209,10 +1211,10 @@ mod traits {
     /// // &s[3 .. 100];
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index> for str {
+    impl ops::Index> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::Range) -> &str {
+        fn index(&self, index: &ops::Range) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if index.start <= index.end &&
                self.is_char_boundary(index.start) &&
@@ -1232,10 +1234,10 @@ mod traits {
     /// Panics when `end` does not point to a valid character, or is
     /// out of bounds.
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index> for str {
+    impl ops::Index> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::RangeTo) -> &str {
+        fn index(&self, index: &ops::RangeTo) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if self.is_char_boundary(index.end) {
                 unsafe { self.slice_unchecked(0, index.end) }
@@ -1252,10 +1254,10 @@ mod traits {
     /// Panics when `begin` does not point to a valid character, or is
     /// out of bounds.
     #[stable(feature = "rust1", since = "1.0.0")]
-    impl ops::Index> for str {
+    impl ops::Index> for str {
         type Output = str;
         #[inline]
-        fn index(&self, index: &ops::RangeFrom) -> &str {
+        fn index(&self, index: &ops::RangeFrom) -> &str {
             // is_char_boundary checks that the index is in [0, .len()]
             if self.is_char_boundary(index.start) {
                 unsafe { self.slice_unchecked(index.start, self.len()) }
@@ -1332,40 +1334,40 @@ pub trait StrExt {
     fn bytes<'a>(&'a self) -> Bytes<'a>;
     fn char_indices<'a>(&'a self) -> CharIndices<'a>;
     fn split<'a, P: CharEq>(&'a self, pat: P) -> Split<'a, P>;
-    fn splitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> SplitN<'a, P>;
+    fn splitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> SplitN<'a, P>;
     fn split_terminator<'a, P: CharEq>(&'a self, pat: P) -> SplitTerminator<'a, P>;
-    fn rsplitn<'a, P: CharEq>(&'a self, count: uint, pat: P) -> RSplitN<'a, P>;
+    fn rsplitn<'a, P: CharEq>(&'a self, count: usize, pat: P) -> RSplitN<'a, P>;
     fn match_indices<'a>(&'a self, sep: &'a str) -> MatchIndices<'a>;
     fn split_str<'a>(&'a self, pat: &'a str) -> SplitStr<'a>;
     fn lines<'a>(&'a self) -> Lines<'a>;
     fn lines_any<'a>(&'a self) -> LinesAny<'a>;
-    fn char_len(&self) -> uint;
-    fn slice_chars<'a>(&'a self, begin: uint, end: uint) -> &'a str;
-    unsafe fn slice_unchecked<'a>(&'a self, begin: uint, end: uint) -> &'a str;
+    fn char_len(&self) -> usize;
+    fn slice_chars<'a>(&'a self, begin: usize, end: usize) -> &'a str;
+    unsafe fn slice_unchecked<'a>(&'a self, begin: usize, end: usize) -> &'a str;
     fn starts_with(&self, pat: &str) -> bool;
     fn ends_with(&self, pat: &str) -> bool;
     fn trim_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
     fn trim_left_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
     fn trim_right_matches<'a, P: CharEq>(&'a self, pat: P) -> &'a str;
-    fn is_char_boundary(&self, index: uint) -> bool;
-    fn char_range_at(&self, start: uint) -> CharRange;
-    fn char_range_at_reverse(&self, start: uint) -> CharRange;
-    fn char_at(&self, i: uint) -> char;
-    fn char_at_reverse(&self, i: uint) -> char;
+    fn is_char_boundary(&self, index: usize) -> bool;
+    fn char_range_at(&self, start: usize) -> CharRange;
+    fn char_range_at_reverse(&self, start: usize) -> CharRange;
+    fn char_at(&self, i: usize) -> char;
+    fn char_at_reverse(&self, i: usize) -> char;
     fn as_bytes<'a>(&'a self) -> &'a [u8];
-    fn find(&self, pat: P) -> Option;
-    fn rfind(&self, pat: P) -> Option;
-    fn find_str(&self, pat: &str) -> Option;
+    fn find(&self, pat: P) -> Option;
+    fn rfind(&self, pat: P) -> Option;
+    fn find_str(&self, pat: &str) -> Option;
     fn slice_shift_char<'a>(&'a self) -> Option<(char, &'a str)>;
-    fn subslice_offset(&self, inner: &str) -> uint;
+    fn subslice_offset(&self, inner: &str) -> usize;
     fn as_ptr(&self) -> *const u8;
-    fn len(&self) -> uint;
+    fn len(&self) -> usize;
     fn is_empty(&self) -> bool;
     fn parse(&self) -> Result;
 }
 
 #[inline(never)]
-fn slice_error_fail(s: &str, begin: uint, end: uint) -> ! {
+fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
     assert!(begin <= end);
     panic!("index {} and/or {} in `{}` do not lie on character boundary",
           begin, end, s);
@@ -1409,7 +1411,7 @@ impl StrExt for str {
     }
 
     #[inline]
-    fn splitn(&self, count: uint, pat: P) -> SplitN

{ + fn splitn(&self, count: usize, pat: P) -> SplitN

{ SplitN(CharSplitsN { iter: self.split(pat).0, count: count, @@ -1426,7 +1428,7 @@ impl StrExt for str { } #[inline] - fn rsplitn(&self, count: uint, pat: P) -> RSplitN

{ + fn rsplitn(&self, count: usize, pat: P) -> RSplitN

{ RSplitN(CharSplitsN { iter: self.split(pat).0, count: count, @@ -1470,9 +1472,9 @@ impl StrExt for str { } #[inline] - fn char_len(&self) -> uint { self.chars().count() } + fn char_len(&self) -> usize { self.chars().count() } - fn slice_chars(&self, begin: uint, end: uint) -> &str { + fn slice_chars(&self, begin: usize, end: usize) -> &str { assert!(begin <= end); let mut count = 0; let mut begin_byte = None; @@ -1496,9 +1498,9 @@ impl StrExt for str { } #[inline] - unsafe fn slice_unchecked(&self, begin: uint, end: uint) -> &str { + unsafe fn slice_unchecked(&self, begin: usize, end: usize) -> &str { mem::transmute(Slice { - data: self.as_ptr().offset(begin as int), + data: self.as_ptr().offset(begin as isize), len: end - begin, }) } @@ -1550,7 +1552,7 @@ impl StrExt for str { } #[inline] - fn is_char_boundary(&self, index: uint) -> bool { + fn is_char_boundary(&self, index: usize) -> bool { if index == self.len() { return true; } match self.as_bytes().get(index) { None => false, @@ -1559,13 +1561,13 @@ impl StrExt for str { } #[inline] - fn char_range_at(&self, i: uint) -> CharRange { + fn char_range_at(&self, i: usize) -> CharRange { let (c, n) = char_range_at_raw(self.as_bytes(), i); CharRange { ch: unsafe { mem::transmute(c) }, next: n } } #[inline] - fn char_range_at_reverse(&self, start: uint) -> CharRange { + fn char_range_at_reverse(&self, start: usize) -> CharRange { let mut prev = start; prev = prev.saturating_sub(1); @@ -1574,14 +1576,14 @@ impl StrExt for str { } // Multibyte case is a fn to allow char_range_at_reverse to inline cleanly - fn multibyte_char_range_at_reverse(s: &str, mut i: uint) -> CharRange { + fn multibyte_char_range_at_reverse(s: &str, mut i: usize) -> CharRange { // while there is a previous byte == 10...... while i > 0 && s.as_bytes()[i] & !CONT_MASK == TAG_CONT_U8 { i -= 1; } let mut val = s.as_bytes()[i] as u32; - let w = UTF8_CHAR_WIDTH[val as uint] as uint; + let w = UTF8_CHAR_WIDTH[val as usize] as usize; assert!((w != 0)); val = utf8_first_byte!(val, w); @@ -1596,12 +1598,12 @@ impl StrExt for str { } #[inline] - fn char_at(&self, i: uint) -> char { + fn char_at(&self, i: usize) -> char { self.char_range_at(i).ch } #[inline] - fn char_at_reverse(&self, i: uint) -> char { + fn char_at_reverse(&self, i: usize) -> char { self.char_range_at_reverse(i).ch } @@ -1610,7 +1612,7 @@ impl StrExt for str { unsafe { mem::transmute(self) } } - fn find(&self, mut pat: P) -> Option { + fn find(&self, mut pat: P) -> Option { if pat.only_ascii() { self.bytes().position(|b| pat.matches(b as char)) } else { @@ -1621,7 +1623,7 @@ impl StrExt for str { } } - fn rfind(&self, mut pat: P) -> Option { + fn rfind(&self, mut pat: P) -> Option { if pat.only_ascii() { self.bytes().rposition(|b| pat.matches(b as char)) } else { @@ -1632,7 +1634,7 @@ impl StrExt for str { } } - fn find_str(&self, needle: &str) -> Option { + fn find_str(&self, needle: &str) -> Option { if needle.is_empty() { Some(0) } else { @@ -1653,10 +1655,10 @@ impl StrExt for str { } } - fn subslice_offset(&self, inner: &str) -> uint { - let a_start = self.as_ptr() as uint; + fn subslice_offset(&self, inner: &str) -> usize { + let a_start = self.as_ptr() as usize; let a_end = a_start + self.len(); - let b_start = inner.as_ptr() as uint; + let b_start = inner.as_ptr() as usize; let b_end = b_start + inner.len(); assert!(a_start <= b_start); @@ -1670,7 +1672,7 @@ impl StrExt for str { } #[inline] - fn len(&self) -> uint { self.repr().len } + fn len(&self) -> usize { self.repr().len } #[inline] fn is_empty(&self) -> bool { self.len() == 0 } @@ -1683,15 +1685,15 @@ impl StrExt for str { /// index of the next code point. #[inline] #[unstable(feature = "core")] -pub fn char_range_at_raw(bytes: &[u8], i: uint) -> (u32, usize) { +pub fn char_range_at_raw(bytes: &[u8], i: usize) -> (u32, usize) { if bytes[i] < 128u8 { return (bytes[i] as u32, i + 1); } // Multibyte case is a fn to allow char_range_at to inline cleanly - fn multibyte_char_range_at(bytes: &[u8], i: uint) -> (u32, usize) { + fn multibyte_char_range_at(bytes: &[u8], i: usize) -> (u32, usize) { let mut val = bytes[i] as u32; - let w = UTF8_CHAR_WIDTH[val as uint] as uint; + let w = UTF8_CHAR_WIDTH[val as usize] as usize; assert!((w != 0)); val = utf8_first_byte!(val, w); @@ -1718,7 +1720,7 @@ impl<'a> Iterator for Lines<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } #[stable(feature = "rust1", since = "1.0.0")] @@ -1734,7 +1736,7 @@ impl<'a> Iterator for LinesAny<'a> { #[inline] fn next(&mut self) -> Option<&'a str> { self.inner.next() } #[inline] - fn size_hint(&self) -> (uint, Option) { self.inner.size_hint() } + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index ac48481027d6f..0a3abd5d1acc3 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -159,12 +159,12 @@ impl AsciiExt for u8 { #[inline] fn to_ascii_uppercase(&self) -> u8 { - ASCII_UPPERCASE_MAP[*self as uint] + ASCII_UPPERCASE_MAP[*self as usize] } #[inline] fn to_ascii_lowercase(&self) -> u8 { - ASCII_LOWERCASE_MAP[*self as uint] + ASCII_LOWERCASE_MAP[*self as usize] } #[inline] diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 0ac569b9c8ea3..deffc1fe8da75 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -32,7 +32,6 @@ #![feature(no_std)] #![no_std] #![feature(slicing_syntax)] -#![feature(int_uint)] #![feature(core)] extern crate core; diff --git a/src/libunicode/tables.rs b/src/libunicode/tables.rs index a38f911688d75..61f447a3dd3b6 100644 --- a/src/libunicode/tables.rs +++ b/src/libunicode/tables.rs @@ -14,7 +14,7 @@ /// The version of [Unicode](http://www.unicode.org/) /// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on. -pub const UNICODE_VERSION: (uint, uint, uint) = (7, 0, 0); +pub const UNICODE_VERSION: (u64, u64, u64) = (7, 0, 0); fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool { use core::cmp::Ordering::{Equal, Less, Greater}; @@ -6977,7 +6977,7 @@ pub mod conversions { } } - fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { + fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option { match table.binary_search_by(|&(key, _)| { if c == key { Equal } else if key < c { Less } @@ -7613,13 +7613,13 @@ pub mod charwidth { } } - pub fn width(c: char, is_cjk: bool) -> Option { - match c as uint { + pub fn width(c: char, is_cjk: bool) -> Option { + match c as usize { _c @ 0 => Some(0), // null is zero width cu if cu < 0x20 => None, // control sequences have no width cu if cu < 0x7F => Some(1), // ASCII cu if cu < 0xA0 => None, // more control sequences - _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as uint) + _ => Some(bsearch_range_value_table(c, is_cjk, charwidth_table) as usize) } } diff --git a/src/libunicode/u_char.rs b/src/libunicode/u_char.rs index 467fed5d24670..c0f45ca4d7247 100644 --- a/src/libunicode/u_char.rs +++ b/src/libunicode/u_char.rs @@ -36,7 +36,7 @@ pub trait CharExt { /// Panics if given a radix > 36. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool; + fn is_digit(self, radix: u32) -> bool; /// Converts a character to the corresponding digit. /// @@ -51,7 +51,7 @@ pub trait CharExt { /// Panics if given a radix outside the range [0..36]. #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option; + fn to_digit(self, radix: u32) -> Option; /// Returns an iterator that yields the hexadecimal Unicode escape /// of a character, as `char`s. @@ -80,12 +80,12 @@ pub trait CharExt { /// Returns the amount of bytes this character would need if encoded in /// UTF-8. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint; + fn len_utf8(self) -> usize; /// Returns the amount of bytes this character would need if encoded in /// UTF-16. #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint; + fn len_utf16(self) -> usize; /// Encodes this character as UTF-8 into the provided byte buffer, /// and then returns the number of bytes written. @@ -94,7 +94,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option; + fn encode_utf8(self, dst: &mut [u8]) -> Option; /// Encodes this character as UTF-16 into the provided `u16` buffer, /// and then returns the number of `u16`s written. @@ -103,7 +103,7 @@ pub trait CharExt { /// and a `None` will be returned. #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option; + fn encode_utf16(self, dst: &mut [u16]) -> Option; /// Returns whether the specified character is considered a Unicode /// alphabetic code point. @@ -216,31 +216,31 @@ pub trait CharExt { /// `is_cjk` = `false`) if the context cannot be reliably determined. #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option; + fn width(self, is_cjk: bool) -> Option; } #[stable(feature = "rust1", since = "1.0.0")] impl CharExt for char { #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn is_digit(self, radix: uint) -> bool { C::is_digit(self, radix) } + fn is_digit(self, radix: u32) -> bool { C::is_digit(self, radix) } #[unstable(feature = "unicode", reason = "pending integer conventions")] - fn to_digit(self, radix: uint) -> Option { C::to_digit(self, radix) } + fn to_digit(self, radix: u32) -> Option { C::to_digit(self, radix) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_unicode(self) -> char::EscapeUnicode { C::escape_unicode(self) } #[stable(feature = "rust1", since = "1.0.0")] fn escape_default(self) -> char::EscapeDefault { C::escape_default(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf8(self) -> uint { C::len_utf8(self) } + fn len_utf8(self) -> usize { C::len_utf8(self) } #[stable(feature = "rust1", since = "1.0.0")] - fn len_utf16(self) -> uint { C::len_utf16(self) } + fn len_utf16(self) -> usize { C::len_utf16(self) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } + fn encode_utf8(self, dst: &mut [u8]) -> Option { C::encode_utf8(self, dst) } #[unstable(feature = "unicode", reason = "pending decision about Iterator/Writer/Reader")] - fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } + fn encode_utf16(self, dst: &mut [u16]) -> Option { C::encode_utf16(self, dst) } #[stable(feature = "rust1", since = "1.0.0")] fn is_alphabetic(self) -> bool { @@ -313,5 +313,5 @@ impl CharExt for char { #[unstable(feature = "unicode", reason = "needs expert opinion. is_cjk flag stands out as ugly")] - fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } + fn width(self, is_cjk: bool) -> Option { charwidth::width(self, is_cjk) } } diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 15cf3986e6e80..9bd8c5525a056 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -43,7 +43,7 @@ pub trait UnicodeStr { fn words<'a>(&'a self) -> Words<'a>; fn is_whitespace(&self) -> bool; fn is_alphanumeric(&self) -> bool; - fn width(&self, is_cjk: bool) -> uint; + fn width(&self, is_cjk: bool) -> usize; fn trim<'a>(&'a self) -> &'a str; fn trim_left<'a>(&'a self) -> &'a str; fn trim_right<'a>(&'a self) -> &'a str; @@ -57,7 +57,7 @@ impl UnicodeStr for str { #[inline] fn grapheme_indices(&self, is_extended: bool) -> GraphemeIndices { - GraphemeIndices { start_offset: self.as_ptr() as uint, iter: self.graphemes(is_extended) } + GraphemeIndices { start_offset: self.as_ptr() as usize, iter: self.graphemes(is_extended) } } #[inline] @@ -78,7 +78,7 @@ impl UnicodeStr for str { fn is_alphanumeric(&self) -> bool { self.chars().all(|c| c.is_alphanumeric()) } #[inline] - fn width(&self, is_cjk: bool) -> uint { + fn width(&self, is_cjk: bool) -> usize { self.chars().map(|c| c.width(is_cjk).unwrap_or(0)).sum() } @@ -101,28 +101,28 @@ impl UnicodeStr for str { /// External iterator for grapheme clusters and byte offsets. #[derive(Clone)] pub struct GraphemeIndices<'a> { - start_offset: uint, + start_offset: usize, iter: Graphemes<'a>, } impl<'a> Iterator for GraphemeIndices<'a> { - type Item = (uint, &'a str); + type Item = (usize, &'a str); #[inline] - fn next(&mut self) -> Option<(uint, &'a str)> { - self.iter.next().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next(&mut self) -> Option<(usize, &'a str)> { + self.iter.next().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } } impl<'a> DoubleEndedIterator for GraphemeIndices<'a> { #[inline] - fn next_back(&mut self) -> Option<(uint, &'a str)> { - self.iter.next_back().map(|s| (s.as_ptr() as uint - self.start_offset, s)) + fn next_back(&mut self) -> Option<(usize, &'a str)> { + self.iter.next_back().map(|s| (s.as_ptr() as usize - self.start_offset, s)) } } @@ -151,7 +151,7 @@ impl<'a> Iterator for Graphemes<'a> { type Item = &'a str; #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let slen = self.string.len(); (cmp::min(slen, 1), Some(slen)) } @@ -378,8 +378,8 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [ /// Given a first byte, determine how many bytes are in this UTF-8 character #[inline] -pub fn utf8_char_width(b: u8) -> uint { - return UTF8_CHAR_WIDTH[b as uint] as uint; +pub fn utf8_char_width(b: u8) -> usize { + return UTF8_CHAR_WIDTH[b as usize] as usize; } /// Determines if a vector of `u16` contains valid UTF-16 @@ -468,7 +468,7 @@ impl<'a> Iterator for Utf16Items<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (low, high) = self.iter.size_hint(); // we could be entirely valid surrogates (2 elements per // char), or entirely non-surrogates (1 element per char) @@ -534,7 +534,7 @@ impl Iterator for Utf16Encoder where I: Iterator { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (low, high) = self.chars.size_hint(); // every char gets either one u16 or two u16, // so this iterator is between 1 or 2 times as From b1cd76906a4c7e40e3eb3569450d2dbd3be9fcab Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 15 Feb 2015 00:10:19 +0300 Subject: [PATCH 48/54] Fix the fallout --- src/libcore/fmt/float.rs | 10 +++++----- src/libcore/num/mod.rs | 8 ++++---- src/libfmt_macros/lib.rs | 2 +- src/libstd/num/f32.rs | 14 +++++++------- src/libstd/num/f64.rs | 14 +++++++------- src/libstd/num/strconv.rs | 14 +++++++------- src/libsyntax/parse/lexer/mod.rs | 2 +- src/libterm/terminfo/parm.rs | 2 +- src/test/run-pass/exponential-notation.rs | 10 +++++----- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 25bb959b9b3aa..8e09e52daee19 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -53,7 +53,7 @@ pub enum SignFormat { SignNeg } -static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11; +static DIGIT_E_RADIX: u32 = ('e' as u32) - ('a' as u32) + 11; /// Converts a number to its string representation as a byte vector. /// This is meant to be a common base implementation for all numeric string @@ -87,7 +87,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11; /// between digit and exponent sign `'p'`. pub fn float_to_str_bytes_common( num: T, - radix: uint, + radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, @@ -156,7 +156,7 @@ pub fn float_to_str_bytes_common( deccum = deccum / radix_gen; deccum = deccum.trunc(); - let c = char::from_digit(current_digit.to_int().unwrap() as uint, radix); + let c = char::from_digit(current_digit.to_int().unwrap() as u32, radix); buf[end] = c.unwrap() as u8; end += 1; @@ -211,7 +211,7 @@ pub fn float_to_str_bytes_common( // See note in first loop. let current_digit = deccum.trunc().abs(); - let c = char::from_digit(current_digit.to_int().unwrap() as uint, + let c = char::from_digit(current_digit.to_int().unwrap() as u32, radix); buf[end] = c.unwrap() as u8; end += 1; @@ -228,7 +228,7 @@ pub fn float_to_str_bytes_common( let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |val: uint| { + let value2ascii = |val: u32| { char::from_digit(val, radix).unwrap() as u8 }; diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index b7c5c6640ced0..d6c01ddc74acb 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1432,12 +1432,12 @@ pub trait Float #[unstable(feature = "core", reason = "needs reevaluation")] pub trait FromStrRadix { type Err; - fn from_str_radix(str: &str, radix: uint) -> Result; + fn from_str_radix(str: &str, radix: u32) -> Result; } /// A utility function that just calls FromStrRadix::from_str_radix. #[unstable(feature = "core", reason = "needs reevaluation")] -pub fn from_str_radix(str: &str, radix: uint) +pub fn from_str_radix(str: &str, radix: u32) -> Result { FromStrRadix::from_str_radix(str, radix) } @@ -1501,7 +1501,7 @@ macro_rules! from_str_radix_float_impl { /// `None` if the string did not represent a valid number. /// Otherwise, `Some(n)` where `n` is the floating-point number /// represented by `src`. - fn from_str_radix(src: &str, radix: uint) + fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseFloatError> { use self::FloatErrorKind::*; use self::ParseFloatError as PFE; @@ -1661,7 +1661,7 @@ macro_rules! from_str_radix_int_impl { #[stable(feature = "rust1", since = "1.0.0")] impl FromStrRadix for $T { type Err = ParseIntError; - fn from_str_radix(src: &str, radix: uint) + fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> { use self::IntErrorKind::*; use self::ParseIntError as PIE; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index fc8d18df81523..baad31a61e105 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -422,7 +422,7 @@ impl<'a> Parser<'a> { Some((_, c)) => { match c.to_digit(10) { Some(i) => { - cur = cur * 10 + i; + cur = cur * 10 + i as usize; found = true; self.cur.next(); } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 58b93665fe153..62ed824c3ba9e 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -369,7 +369,7 @@ impl Float for f32 { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f32) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigAll, ExpNone, false); + num, 10, true, SignNeg, DigAll, ExpNone, false); r } @@ -382,7 +382,7 @@ pub fn to_string(num: f32) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f32) -> String { let (r, _) = strconv::float_to_str_common( - num, 16u, true, SignNeg, DigAll, ExpNone, false); + num, 16, true, SignNeg, DigAll, ExpNone, false); r } @@ -395,7 +395,7 @@ pub fn to_str_hex(num: f32) -> String { /// * radix - The base to use #[inline] #[unstable(feature = "std_misc", reason = "may be removed or relocated")] -pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { +pub fn to_str_radix_special(num: f32, rdx: u32) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -410,7 +410,7 @@ pub fn to_str_radix_special(num: f32, rdx: uint) -> (String, bool) { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); + num, 10, true, SignNeg, DigExact(dig), ExpNone, false); r } @@ -425,7 +425,7 @@ pub fn to_str_exact(num: f32, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f32, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); + num, 10, true, SignNeg, DigMax(dig), ExpNone, false); r } @@ -441,7 +441,7 @@ pub fn to_str_digits(num: f32, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); + num, 10, true, SignNeg, DigExact(dig), ExpDec, upper); r } @@ -457,7 +457,7 @@ pub fn to_str_exp_exact(num: f32, dig: uint, upper: bool) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f32, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); + num, 10, true, SignNeg, DigMax(dig), ExpDec, upper); r } diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 8b17feeb70cdc..0e2ac97ca01ea 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -378,7 +378,7 @@ impl Float for f64 { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_string(num: f64) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigAll, ExpNone, false); + num, 10, true, SignNeg, DigAll, ExpNone, false); r } @@ -391,7 +391,7 @@ pub fn to_string(num: f64) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_hex(num: f64) -> String { let (r, _) = strconv::float_to_str_common( - num, 16u, true, SignNeg, DigAll, ExpNone, false); + num, 16, true, SignNeg, DigAll, ExpNone, false); r } @@ -404,7 +404,7 @@ pub fn to_str_hex(num: f64) -> String { /// * radix - The base to use #[inline] #[unstable(feature = "std_misc", reason = "may be removed or relocated")] -pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { +pub fn to_str_radix_special(num: f64, rdx: u32) -> (String, bool) { strconv::float_to_str_common(num, rdx, true, SignNeg, DigAll, ExpNone, false) } @@ -419,7 +419,7 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (String, bool) { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exact(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpNone, false); + num, 10, true, SignNeg, DigExact(dig), ExpNone, false); r } @@ -434,7 +434,7 @@ pub fn to_str_exact(num: f64, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_digits(num: f64, dig: uint) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpNone, false); + num, 10, true, SignNeg, DigMax(dig), ExpNone, false); r } @@ -450,7 +450,7 @@ pub fn to_str_digits(num: f64, dig: uint) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigExact(dig), ExpDec, upper); + num, 10, true, SignNeg, DigExact(dig), ExpDec, upper); r } @@ -466,7 +466,7 @@ pub fn to_str_exp_exact(num: f64, dig: uint, upper: bool) -> String { #[unstable(feature = "std_misc", reason = "may be removed or relocated")] pub fn to_str_exp_digits(num: f64, dig: uint, upper: bool) -> String { let (r, _) = strconv::float_to_str_common( - num, 10u, true, SignNeg, DigMax(dig), ExpDec, upper); + num, 10, true, SignNeg, DigMax(dig), ExpDec, upper); r } diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 4ae7d3437fd93..cf5e1eb0eb7ca 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -182,7 +182,7 @@ fn int_to_str_bytes_common(num: T, radix: uint, sign: SignFormat, mut f: F /// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict /// between digit and exponent sign `'p'`. pub fn float_to_str_bytes_common( - num: T, radix: uint, negative_zero: bool, + num: T, radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool ) -> (Vec, bool) { assert!(2 <= radix && radix <= 36); @@ -253,7 +253,7 @@ pub fn float_to_str_bytes_common( deccum = deccum / radix_gen; deccum = deccum.trunc(); - buf.push(char::from_digit(current_digit.to_int().unwrap() as uint, radix) + buf.push(char::from_digit(current_digit.to_int().unwrap() as u32, radix) .unwrap() as u8); // No more digits to calculate for the non-fractional part -> break @@ -310,7 +310,7 @@ pub fn float_to_str_bytes_common( let current_digit = deccum.trunc().abs(); buf.push(char::from_digit( - current_digit.to_int().unwrap() as uint, radix).unwrap() as u8); + current_digit.to_int().unwrap() as u32, radix).unwrap() as u8); // Decrease the deccumulator one fractional digit at a time deccum = deccum.fract(); @@ -324,7 +324,7 @@ pub fn float_to_str_bytes_common( let ascii2value = |chr: u8| { (chr as char).to_digit(radix).unwrap() }; - let value2ascii = |val: uint| { + let value2ascii = |val: u32| { char::from_digit(val, radix).unwrap() as u8 }; @@ -412,7 +412,7 @@ pub fn float_to_str_bytes_common( /// `to_str_bytes_common()`, for details see there. #[inline] pub fn float_to_str_common( - num: T, radix: uint, negative_zero: bool, + num: T, radix: u32, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_capital: bool ) -> (String, bool) { let (bytes, special) = float_to_str_bytes_common(num, radix, @@ -422,8 +422,8 @@ pub fn float_to_str_common( // Some constants for from_str_bytes_common's input validation, // they define minimum radix values for which the character is a valid digit. -static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u; -static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; +static DIGIT_P_RADIX: u32 = ('p' as u32) - ('a' as u32) + 11; +static DIGIT_E_RADIX: u32 = ('e' as u32) - ('a' as u32) + 11; #[cfg(test)] mod tests { diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index ecc39925a40c5..cfd80b6755cf9 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -645,7 +645,7 @@ impl<'a> StringReader<'a> { /// Scan through any digits (base `radix`) or underscores, and return how /// many digits there were. - fn scan_digits(&mut self, radix: usize) -> usize { + fn scan_digits(&mut self, radix: u32) -> usize { let mut len = 0; loop { let c = self.curr; diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 016dc84b23b9e..82b5ec11d95d1 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -297,7 +297,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) PushParam => { // params are 1-indexed stack.push(mparams[match cur.to_digit(10) { - Some(d) => d - 1, + Some(d) => d as usize - 1, None => return Err("bad param number".to_string()) }].clone()); }, diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs index 1fb434f7d7619..bfe22712de8c3 100644 --- a/src/test/run-pass/exponential-notation.rs +++ b/src/test/run-pass/exponential-notation.rs @@ -19,18 +19,18 @@ macro_rules! t { pub fn main() { // Basic usage - t!(to_string(1.2345678e-5f64, 10u, true, SignNeg, DigMax(6), ExpDec, false), + t!(to_string(1.2345678e-5f64, 10, true, SignNeg, DigMax(6), ExpDec, false), "1.234568e-5"); // Hexadecimal output - t!(to_string(7.281738281250e+01f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(7.281738281250e+01f64, 16, true, SignAll, DigMax(6), ExpBin, false), "+1.2345p+6"); - t!(to_string(-1.777768135071e-02f64, 16u, true, SignAll, DigMax(6), ExpBin, false), + t!(to_string(-1.777768135071e-02f64, 16, true, SignAll, DigMax(6), ExpBin, false), "-1.2345p-6"); // Some denormals - t!(to_string(4.9406564584124654e-324f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(4.9406564584124654e-324f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1074"); - t!(to_string(2.2250738585072009e-308f64, 10u, true, SignNeg, DigMax(6), ExpBin, false), + t!(to_string(2.2250738585072009e-308f64, 10, true, SignNeg, DigMax(6), ExpBin, false), "1p-1022"); } From 8f5d698bac39fba76659b197b476d79682ceae3a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 14 Feb 2015 15:43:51 -0800 Subject: [PATCH 49/54] core::raw: uint -> usize --- src/libcore/raw.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 3fd244b46e30f..10b9361db63b5 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -25,7 +25,7 @@ use mem; #[repr(C)] pub struct Slice { pub data: *const T, - pub len: uint, + pub len: usize, } impl Copy for Slice {} From 438e527226f3b9b2d75ce37e76d449048f6fb195 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 14 Feb 2015 15:50:26 -0800 Subject: [PATCH 50/54] core: Use int/isize in Clone boilerplate --- src/libcore/clone.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 28c306fc0099f..058eff121e633 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -61,13 +61,13 @@ macro_rules! clone_impl { } } -clone_impl! { int } +clone_impl! { isize } clone_impl! { i8 } clone_impl! { i16 } clone_impl! { i32 } clone_impl! { i64 } -clone_impl! { uint } +clone_impl! { usize } clone_impl! { u8 } clone_impl! { u16 } clone_impl! { u32 } From 1a99315c512cc5bd95e15705b2f34a815f1e882e Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sat, 14 Feb 2015 20:50:08 -0500 Subject: [PATCH 51/54] Fix issue with generation --- src/doc/grammar.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index b4e023c203911..9124328b8eee9 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -1,6 +1,4 @@ -# **This is a work in progress** - -% The Rust Grammar +% Grammar # Introduction From e72fb354dcec11e20278c66d5a886409b1c3846f Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 14 Feb 2015 16:04:47 -0800 Subject: [PATCH 52/54] core::slice: uint -> usize, int -> isize --- src/libcore/slice.rs | 234 +++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index cf1df4ac423ca..097633b706312 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -66,28 +66,28 @@ use raw::Slice as RawSlice; pub trait SliceExt { type Item; - fn split_at<'a>(&'a self, mid: uint) -> (&'a [Self::Item], &'a [Self::Item]); + fn split_at<'a>(&'a self, mid: usize) -> (&'a [Self::Item], &'a [Self::Item]); fn iter<'a>(&'a self) -> Iter<'a, Self::Item>; fn split<'a, P>(&'a self, pred: P) -> Split<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn splitn<'a, P>(&'a self, n: uint, pred: P) -> SplitN<'a, Self::Item, P> + fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn rsplitn<'a, P>(&'a self, n: uint, pred: P) -> RSplitN<'a, Self::Item, P> + fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn windows<'a>(&'a self, size: uint) -> Windows<'a, Self::Item>; - fn chunks<'a>(&'a self, size: uint) -> Chunks<'a, Self::Item>; - fn get<'a>(&'a self, index: uint) -> Option<&'a Self::Item>; + fn windows<'a>(&'a self, size: usize) -> Windows<'a, Self::Item>; + fn chunks<'a>(&'a self, size: usize) -> Chunks<'a, Self::Item>; + fn get<'a>(&'a self, index: usize) -> Option<&'a Self::Item>; fn first<'a>(&'a self) -> Option<&'a Self::Item>; fn tail<'a>(&'a self) -> &'a [Self::Item]; fn init<'a>(&'a self) -> &'a [Self::Item]; fn last<'a>(&'a self) -> Option<&'a Self::Item>; - unsafe fn get_unchecked<'a>(&'a self, index: uint) -> &'a Self::Item; + unsafe fn get_unchecked<'a>(&'a self, index: usize) -> &'a Self::Item; fn as_ptr(&self) -> *const Self::Item; - fn binary_search_by(&self, f: F) -> Result where + fn binary_search_by(&self, f: F) -> Result where F: FnMut(&Self::Item) -> Ordering; - fn len(&self) -> uint; + fn len(&self) -> usize; fn is_empty(&self) -> bool { self.len() == 0 } - fn get_mut<'a>(&'a mut self, index: uint) -> Option<&'a mut Self::Item>; + fn get_mut<'a>(&'a mut self, index: usize) -> Option<&'a mut Self::Item>; fn as_mut_slice<'a>(&'a mut self) -> &'a mut [Self::Item]; fn iter_mut<'a>(&'a mut self) -> IterMut<'a, Self::Item>; fn first_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>; @@ -96,20 +96,20 @@ pub trait SliceExt { fn last_mut<'a>(&'a mut self) -> Option<&'a mut Self::Item>; fn split_mut<'a, P>(&'a mut self, pred: P) -> SplitMut<'a, Self::Item, P> where P: FnMut(&Self::Item) -> bool; - fn splitn_mut

(&mut self, n: uint, pred: P) -> SplitNMut + fn splitn_mut

(&mut self, n: usize, pred: P) -> SplitNMut where P: FnMut(&Self::Item) -> bool; - fn rsplitn_mut

(&mut self, n: uint, pred: P) -> RSplitNMut + fn rsplitn_mut

(&mut self, n: usize, pred: P) -> RSplitNMut where P: FnMut(&Self::Item) -> bool; - fn chunks_mut<'a>(&'a mut self, chunk_size: uint) -> ChunksMut<'a, Self::Item>; - fn swap(&mut self, a: uint, b: uint); - fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [Self::Item], &'a mut [Self::Item]); + fn chunks_mut<'a>(&'a mut self, chunk_size: usize) -> ChunksMut<'a, Self::Item>; + fn swap(&mut self, a: usize, b: usize); + fn split_at_mut<'a>(&'a mut self, mid: usize) -> (&'a mut [Self::Item], &'a mut [Self::Item]); fn reverse(&mut self); - unsafe fn get_unchecked_mut<'a>(&'a mut self, index: uint) -> &'a mut Self::Item; + unsafe fn get_unchecked_mut<'a>(&'a mut self, index: usize) -> &'a mut Self::Item; fn as_mut_ptr(&mut self) -> *mut Self::Item; - fn position_elem(&self, t: &Self::Item) -> Option where Self::Item: PartialEq; + fn position_elem(&self, t: &Self::Item) -> Option where Self::Item: PartialEq; - fn rposition_elem(&self, t: &Self::Item) -> Option where Self::Item: PartialEq; + fn rposition_elem(&self, t: &Self::Item) -> Option where Self::Item: PartialEq; fn contains(&self, x: &Self::Item) -> bool where Self::Item: PartialEq; @@ -117,11 +117,11 @@ pub trait SliceExt { fn ends_with(&self, needle: &[Self::Item]) -> bool where Self::Item: PartialEq; - fn binary_search(&self, x: &Self::Item) -> Result where Self::Item: Ord; + fn binary_search(&self, x: &Self::Item) -> Result where Self::Item: Ord; fn next_permutation(&mut self) -> bool where Self::Item: Ord; fn prev_permutation(&mut self) -> bool where Self::Item: Ord; - fn clone_from_slice(&mut self, &[Self::Item]) -> uint where Self::Item: Clone; + fn clone_from_slice(&mut self, &[Self::Item]) -> usize where Self::Item: Clone; } #[unstable(feature = "core")] @@ -129,7 +129,7 @@ impl SliceExt for [T] { type Item = T; #[inline] - fn split_at(&self, mid: uint) -> (&[T], &[T]) { + fn split_at(&self, mid: usize) -> (&[T], &[T]) { (&self[..mid], &self[mid..]) } @@ -139,11 +139,11 @@ impl SliceExt for [T] { let p = self.as_ptr(); if mem::size_of::() == 0 { Iter {ptr: p, - end: (p as uint + self.len()) as *const T, + end: (p as usize + self.len()) as *const T, marker: marker::ContravariantLifetime::<'a>} } else { Iter {ptr: p, - end: p.offset(self.len() as int), + end: p.offset(self.len() as isize), marker: marker::ContravariantLifetime::<'a>} } } @@ -159,7 +159,7 @@ impl SliceExt for [T] { } #[inline] - fn splitn<'a, P>(&'a self, n: uint, pred: P) -> SplitN<'a, T, P> where + fn splitn<'a, P>(&'a self, n: usize, pred: P) -> SplitN<'a, T, P> where P: FnMut(&T) -> bool, { SplitN { @@ -172,7 +172,7 @@ impl SliceExt for [T] { } #[inline] - fn rsplitn<'a, P>(&'a self, n: uint, pred: P) -> RSplitN<'a, T, P> where + fn rsplitn<'a, P>(&'a self, n: usize, pred: P) -> RSplitN<'a, T, P> where P: FnMut(&T) -> bool, { RSplitN { @@ -185,19 +185,19 @@ impl SliceExt for [T] { } #[inline] - fn windows(&self, size: uint) -> Windows { + fn windows(&self, size: usize) -> Windows { assert!(size != 0); Windows { v: self, size: size } } #[inline] - fn chunks(&self, size: uint) -> Chunks { + fn chunks(&self, size: usize) -> Chunks { assert!(size != 0); Chunks { v: self, size: size } } #[inline] - fn get(&self, index: uint) -> Option<&T> { + fn get(&self, index: usize) -> Option<&T> { if index < self.len() { Some(&self[index]) } else { None } } @@ -220,8 +220,8 @@ impl SliceExt for [T] { } #[inline] - unsafe fn get_unchecked(&self, index: uint) -> &T { - transmute(self.repr().data.offset(index as int)) + unsafe fn get_unchecked(&self, index: usize) -> &T { + transmute(self.repr().data.offset(index as isize)) } #[inline] @@ -230,11 +230,11 @@ impl SliceExt for [T] { } #[unstable(feature = "core")] - fn binary_search_by(&self, mut f: F) -> Result where + fn binary_search_by(&self, mut f: F) -> Result where F: FnMut(&T) -> Ordering { - let mut base : uint = 0; - let mut lim : uint = self.len(); + let mut base : usize = 0; + let mut lim : usize = self.len(); while lim != 0 { let ix = base + (lim >> 1); @@ -252,10 +252,10 @@ impl SliceExt for [T] { } #[inline] - fn len(&self) -> uint { self.repr().len } + fn len(&self) -> usize { self.repr().len } #[inline] - fn get_mut(&mut self, index: uint) -> Option<&mut T> { + fn get_mut(&mut self, index: usize) -> Option<&mut T> { if index < self.len() { Some(&mut self[index]) } else { None } } @@ -263,7 +263,7 @@ impl SliceExt for [T] { fn as_mut_slice(&mut self) -> &mut [T] { self } #[inline] - fn split_at_mut(&mut self, mid: uint) -> (&mut [T], &mut [T]) { + fn split_at_mut(&mut self, mid: usize) -> (&mut [T], &mut [T]) { unsafe { let self2: &mut [T] = mem::transmute_copy(&self); @@ -278,11 +278,11 @@ impl SliceExt for [T] { let p = self.as_mut_ptr(); if mem::size_of::() == 0 { IterMut {ptr: p, - end: (p as uint + self.len()) as *mut T, + end: (p as usize + self.len()) as *mut T, marker: marker::ContravariantLifetime::<'a>} } else { IterMut {ptr: p, - end: p.offset(self.len() as int), + end: p.offset(self.len() as isize), marker: marker::ContravariantLifetime::<'a>} } } @@ -317,7 +317,7 @@ impl SliceExt for [T] { } #[inline] - fn splitn_mut<'a, P>(&'a mut self, n: uint, pred: P) -> SplitNMut<'a, T, P> where + fn splitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> SplitNMut<'a, T, P> where P: FnMut(&T) -> bool { SplitNMut { @@ -330,7 +330,7 @@ impl SliceExt for [T] { } #[inline] - fn rsplitn_mut<'a, P>(&'a mut self, n: uint, pred: P) -> RSplitNMut<'a, T, P> where + fn rsplitn_mut<'a, P>(&'a mut self, n: usize, pred: P) -> RSplitNMut<'a, T, P> where P: FnMut(&T) -> bool, { RSplitNMut { @@ -343,12 +343,12 @@ impl SliceExt for [T] { } #[inline] - fn chunks_mut(&mut self, chunk_size: uint) -> ChunksMut { + fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut { assert!(chunk_size > 0); ChunksMut { v: self, chunk_size: chunk_size } } - fn swap(&mut self, a: uint, b: uint) { + fn swap(&mut self, a: usize, b: usize) { unsafe { // Can't take two mutable loans from one vector, so instead just cast // them to their raw pointers to do the swap @@ -359,7 +359,7 @@ impl SliceExt for [T] { } fn reverse(&mut self) { - let mut i: uint = 0; + let mut i: usize = 0; let ln = self.len(); while i < ln / 2 { // Unsafe swap to avoid the bounds check in safe swap. @@ -373,8 +373,8 @@ impl SliceExt for [T] { } #[inline] - unsafe fn get_unchecked_mut(&mut self, index: uint) -> &mut T { - transmute((self.repr().data as *mut T).offset(index as int)) + unsafe fn get_unchecked_mut(&mut self, index: usize) -> &mut T { + transmute((self.repr().data as *mut T).offset(index as isize)) } #[inline] @@ -383,12 +383,12 @@ impl SliceExt for [T] { } #[inline] - fn position_elem(&self, x: &T) -> Option where T: PartialEq { + fn position_elem(&self, x: &T) -> Option where T: PartialEq { self.iter().position(|y| *x == *y) } #[inline] - fn rposition_elem(&self, t: &T) -> Option where T: PartialEq { + fn rposition_elem(&self, t: &T) -> Option where T: PartialEq { self.iter().rposition(|x| *x == *t) } @@ -410,7 +410,7 @@ impl SliceExt for [T] { } #[unstable(feature = "core")] - fn binary_search(&self, x: &T) -> Result where T: Ord { + fn binary_search(&self, x: &T) -> Result where T: Ord { self.binary_search_by(|p| p.cmp(x)) } @@ -477,7 +477,7 @@ impl SliceExt for [T] { } #[inline] - fn clone_from_slice(&mut self, src: &[T]) -> uint where T: Clone { + 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]; @@ -489,53 +489,53 @@ impl SliceExt for [T] { } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::Index for [T] { +impl ops::Index for [T] { type Output = T; - fn index(&self, &index: &uint) -> &T { + fn index(&self, &index: &usize) -> &T { assert!(index < self.len()); - unsafe { mem::transmute(self.repr().data.offset(index as int)) } + unsafe { mem::transmute(self.repr().data.offset(index as isize)) } } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::IndexMut for [T] { - fn index_mut(&mut self, &index: &uint) -> &mut T { +impl ops::IndexMut for [T] { + fn index_mut(&mut self, &index: &usize) -> &mut T { assert!(index < self.len()); - unsafe { mem::transmute(self.repr().data.offset(index as int)) } + unsafe { mem::transmute(self.repr().data.offset(index as isize)) } } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::Index> for [T] { +impl ops::Index> for [T] { type Output = [T]; #[inline] - fn index(&self, index: &ops::Range) -> &[T] { + fn index(&self, index: &ops::Range) -> &[T] { assert!(index.start <= index.end); assert!(index.end <= self.len()); unsafe { transmute(RawSlice { - data: self.as_ptr().offset(index.start as int), + data: self.as_ptr().offset(index.start as isize), len: index.end - index.start }) } } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::Index> for [T] { +impl ops::Index> for [T] { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { + fn index(&self, index: &ops::RangeTo) -> &[T] { self.index(&ops::Range{ start: 0, end: index.end }) } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::Index> for [T] { +impl ops::Index> for [T] { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { + fn index(&self, index: &ops::RangeFrom) -> &[T] { self.index(&ops::Range{ start: index.start, end: self.len() }) } } @@ -549,30 +549,30 @@ impl ops::Index for [T] { } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::IndexMut> for [T] { +impl ops::IndexMut> for [T] { #[inline] - fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { + fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { assert!(index.start <= index.end); assert!(index.end <= self.len()); unsafe { transmute(RawSlice { - data: self.as_ptr().offset(index.start as int), + data: self.as_ptr().offset(index.start as isize), len: index.end - index.start }) } } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::IndexMut> for [T] { +impl ops::IndexMut> for [T] { #[inline] - fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { + fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { self.index_mut(&ops::Range{ start: 0, end: index.end }) } } #[stable(feature = "rust1", since = "1.0.0")] -impl ops::IndexMut> for [T] { +impl ops::IndexMut> for [T] { #[inline] - fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { + fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { let len = self.len(); self.index_mut(&ops::Range{ start: index.start, end: len }) } @@ -660,7 +660,7 @@ macro_rules! iterator { // purposefully don't use 'ptr.offset' because for // vectors with 0-size elements this would return the // same pointer. - self.ptr = transmute(self.ptr as uint + 1); + self.ptr = transmute(self.ptr as usize + 1); // Use a non-null pointer value Some(&mut *(1 as *mut _)) @@ -675,8 +675,8 @@ macro_rules! iterator { } #[inline] - fn size_hint(&self) -> (uint, Option) { - let diff = (self.end as uint) - (self.ptr as uint); + fn size_hint(&self) -> (usize, Option) { + let diff = (self.end as usize) - (self.ptr as usize); let size = mem::size_of::(); let exact = diff / (if size == 0 {1} else {size}); (exact, Some(exact)) @@ -694,7 +694,7 @@ macro_rules! iterator { } else { if mem::size_of::() == 0 { // See above for why 'ptr.offset' isn't used - self.end = transmute(self.end as uint - 1); + self.end = transmute(self.end as usize - 1); // Use a non-null pointer value Some(&mut *(1 as *mut _)) @@ -712,7 +712,7 @@ macro_rules! iterator { macro_rules! make_slice { ($t: ty => $result: ty: $start: expr, $end: expr) => {{ - let diff = $end as uint - $start as uint; + let diff = $end as usize - $start as usize; let len = if mem::size_of::() == 0 { diff } else { @@ -733,28 +733,28 @@ pub struct Iter<'a, T: 'a> { } #[unstable(feature = "core")] -impl<'a, T> ops::Index> for Iter<'a, T> { +impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::Range) -> &[T] { + fn index(&self, index: &ops::Range) -> &[T] { self.as_slice().index(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::Index> for Iter<'a, T> { +impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { + fn index(&self, index: &ops::RangeTo) -> &[T] { self.as_slice().index(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::Index> for Iter<'a, T> { +impl<'a, T> ops::Index> for Iter<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { + fn index(&self, index: &ops::RangeFrom) -> &[T] { self.as_slice().index(index) } } @@ -792,20 +792,20 @@ impl<'a, T> Clone for Iter<'a, T> { #[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Iter<'a, T> { #[inline] - fn indexable(&self) -> uint { + fn indexable(&self) -> usize { let (exact, _) = self.size_hint(); exact } #[inline] - fn idx(&mut self, index: uint) -> Option<&'a T> { + fn idx(&mut self, index: usize) -> Option<&'a T> { unsafe { if index < self.indexable() { if mem::size_of::() == 0 { // Use a non-null pointer value Some(&mut *(1 as *mut _)) } else { - Some(transmute(self.ptr.offset(index as int))) + Some(transmute(self.ptr.offset(index as isize))) } } else { None @@ -824,26 +824,26 @@ pub struct IterMut<'a, T: 'a> { #[unstable(feature = "core")] -impl<'a, T> ops::Index> for IterMut<'a, T> { +impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::Range) -> &[T] { + fn index(&self, index: &ops::Range) -> &[T] { self.index(&RangeFull).index(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::Index> for IterMut<'a, T> { +impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeTo) -> &[T] { + fn index(&self, index: &ops::RangeTo) -> &[T] { self.index(&RangeFull).index(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::Index> for IterMut<'a, T> { +impl<'a, T> ops::Index> for IterMut<'a, T> { type Output = [T]; #[inline] - fn index(&self, index: &ops::RangeFrom) -> &[T] { + fn index(&self, index: &ops::RangeFrom) -> &[T] { self.index(&RangeFull).index(index) } } @@ -857,23 +857,23 @@ impl<'a, T> ops::Index for IterMut<'a, T> { } #[unstable(feature = "core")] -impl<'a, T> ops::IndexMut> for IterMut<'a, T> { +impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[inline] - fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { + fn index_mut(&mut self, index: &ops::Range) -> &mut [T] { self.index_mut(&RangeFull).index_mut(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::IndexMut> for IterMut<'a, T> { +impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[inline] - fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { + fn index_mut(&mut self, index: &ops::RangeTo) -> &mut [T] { self.index_mut(&RangeFull).index_mut(index) } } #[unstable(feature = "core")] -impl<'a, T> ops::IndexMut> for IterMut<'a, T> { +impl<'a, T> ops::IndexMut> for IterMut<'a, T> { #[inline] - fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { + fn index_mut(&mut self, index: &ops::RangeFrom) -> &mut [T] { self.index_mut(&RangeFull).index_mut(index) } } @@ -952,7 +952,7 @@ impl<'a, T, P> Iterator for Split<'a, T, P> where P: FnMut(&T) -> bool { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { if self.finished { (0, Some(0)) } else { @@ -1030,7 +1030,7 @@ impl<'a, T, P> Iterator for SplitMut<'a, T, P> where P: FnMut(&T) -> bool { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { if self.finished { (0, Some(0)) } else { @@ -1070,7 +1070,7 @@ impl<'a, T, P> DoubleEndedIterator for SplitMut<'a, T, P> where /// times. struct GenericSplitN { iter: I, - count: uint, + count: usize, invert: bool } @@ -1088,7 +1088,7 @@ impl> Iterator for GenericSplitN { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { let (lower, upper_opt) = self.iter.size_hint(); (lower, upper_opt.map(|upper| cmp::min(self.count + 1, upper))) } @@ -1138,7 +1138,7 @@ macro_rules! forward_iterator { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { self.inner.size_hint() } } @@ -1155,7 +1155,7 @@ forward_iterator! { RSplitNMut: T, &'a mut [T] } #[stable(feature = "rust1", since = "1.0.0")] pub struct Windows<'a, T:'a> { v: &'a [T], - size: uint + size: usize } #[stable(feature = "rust1", since = "1.0.0")] @@ -1174,7 +1174,7 @@ impl<'a, T> Iterator for Windows<'a, T> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { if self.size > self.v.len() { (0, Some(0)) } else { @@ -1204,12 +1204,12 @@ impl<'a, T> ExactSizeIterator for Windows<'a, T> {} #[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Windows<'a, T> { #[inline] - fn indexable(&self) -> uint { + fn indexable(&self) -> usize { self.size_hint().0 } #[inline] - fn idx(&mut self, index: uint) -> Option<&'a [T]> { + fn idx(&mut self, index: usize) -> Option<&'a [T]> { if index + self.size > self.v.len() { None } else { @@ -1227,7 +1227,7 @@ impl<'a, T> RandomAccessIterator for Windows<'a, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct Chunks<'a, T:'a> { v: &'a [T], - size: uint + size: usize } #[stable(feature = "rust1", since = "1.0.0")] @@ -1247,7 +1247,7 @@ impl<'a, T> Iterator for Chunks<'a, T> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { if self.v.len() == 0 { (0, Some(0)) } else { @@ -1281,12 +1281,12 @@ impl<'a, T> ExactSizeIterator for Chunks<'a, T> {} #[unstable(feature = "core", reason = "trait is experimental")] impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[inline] - fn indexable(&self) -> uint { + fn indexable(&self) -> usize { self.v.len()/self.size + if self.v.len() % self.size != 0 { 1 } else { 0 } } #[inline] - fn idx(&mut self, index: uint) -> Option<&'a [T]> { + fn idx(&mut self, index: usize) -> Option<&'a [T]> { if index < self.indexable() { let lo = index * self.size; let mut hi = lo + self.size; @@ -1305,7 +1305,7 @@ impl<'a, T> RandomAccessIterator for Chunks<'a, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct ChunksMut<'a, T:'a> { v: &'a mut [T], - chunk_size: uint + chunk_size: usize } #[stable(feature = "rust1", since = "1.0.0")] @@ -1326,7 +1326,7 @@ impl<'a, T> Iterator for ChunksMut<'a, T> { } #[inline] - fn size_hint(&self) -> (uint, Option) { + fn size_hint(&self) -> (usize, Option) { if self.v.len() == 0 { (0, Some(0)) } else { @@ -1402,7 +1402,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { /// use std::slice; /// /// // manifest a slice out of thin air! -/// let ptr = 0x1234 as *const uint; +/// let ptr = 0x1234 as *const usize; /// let amt = 10; /// unsafe { /// let slice = slice::from_raw_parts(ptr, amt); @@ -1410,7 +1410,7 @@ pub fn mut_ref_slice<'a, A>(s: &'a mut A) -> &'a mut [A] { /// ``` #[inline] #[unstable(feature = "core")] -pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: uint) -> &'a [T] { +pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: usize) -> &'a [T] { transmute(RawSlice { data: p, len: len }) } @@ -1422,7 +1422,7 @@ pub unsafe fn from_raw_parts<'a, T>(p: *const T, len: uint) -> &'a [T] { /// mutable slice. #[inline] #[unstable(feature = "core")] -pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] { +pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] { transmute(RawSlice { data: p, len: len }) } @@ -1445,7 +1445,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] { /// use std::slice; /// /// // manifest a slice out of thin air! -/// let ptr = 0x1234 as *const uint; +/// let ptr = 0x1234 as *const usize; /// let amt = 10; /// unsafe { /// let slice = slice::from_raw_buf(&ptr, amt); @@ -1455,7 +1455,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: uint) -> &'a mut [T] { #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use from_raw_parts")] -pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] { +pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: usize) -> &'a [T] { transmute(RawSlice { data: *p, len: len }) } @@ -1469,7 +1469,7 @@ pub unsafe fn from_raw_buf<'a, T>(p: &'a *const T, len: uint) -> &'a [T] { #[unstable(feature = "core")] #[deprecated(since = "1.0.0", reason = "use from_raw_parts_mut")] -pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] { +pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: usize) -> &'a mut [T] { transmute(RawSlice { data: *p, len: len }) } @@ -1606,4 +1606,4 @@ impl_int_slices! { u8, i8 } impl_int_slices! { u16, i16 } impl_int_slices! { u32, i32 } impl_int_slices! { u64, i64 } -impl_int_slices! { uint, int } +impl_int_slices! { usize, isize } From f0f8be2a2e0aab2efef42208e19886790a0742f5 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 15 Feb 2015 19:07:14 +0530 Subject: [PATCH 53/54] Fix rollup (remove slicing_syntax) --- src/compiletest/compiletest.rs | 2 +- src/libcollections/lib.rs | 1 - src/libcollections/slice.rs | 1 - src/libcore/lib.rs | 2 +- src/libcoretest/lib.rs | 2 +- src/libfmt_macros/lib.rs | 1 - src/libgetopts/lib.rs | 1 - src/libgraphviz/lib.rs | 1 - src/liblog/lib.rs | 1 - src/librbml/lib.rs | 1 - src/librustc/lib.rs | 2 +- src/librustc_driver/lib.rs | 2 +- src/librustc_resolve/lib.rs | 1 - src/librustc_trans/lib.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- src/librustdoc/lib.rs | 1 - src/libserialize/lib.rs | 1 - src/libstd/old_io/net/udp.rs | 1 - src/libsyntax/lib.rs | 1 - src/libterm/lib.rs | 1 - src/libtest/lib.rs | 2 +- src/libunicode/lib.rs | 1 - src/rustbook/main.rs | 2 +- src/test/run-pass/ranges-precedence.rs | 1 - 24 files changed, 9 insertions(+), 24 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 385f1b9e79154..6b6251a96c944 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -16,7 +16,7 @@ #![feature(io)] #![feature(path)] #![feature(rustc_private)] -#![feature(slicing_syntax, unboxed_closures)] +#![feature(unboxed_closures)] #![feature(std_misc)] #![feature(test)] #![feature(unicode)] diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index 460c897b6ad36..8325e7247d5fc 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -27,7 +27,6 @@ #![feature(box_patterns)] #![feature(core)] #![feature(hash)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(unboxed_closures)] #![feature(unicode)] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index b3f398b9cdf49..924589eb44ca9 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -52,7 +52,6 @@ //! interval `[a, b)`: //! //! ```rust -//! #![feature(slicing_syntax)] //! fn main() { //! let numbers = [0, 1, 2]; //! let last_numbers = &numbers[1..3]; 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)] diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs index 50066ab07f555..2dfd81f32c270 100644 --- a/src/libcoretest/lib.rs +++ b/src/libcoretest/lib.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] #![feature(int_uint)] #![feature(unboxed_closures)] -#![feature(unsafe_destructor, slicing_syntax)] +#![feature(unsafe_destructor)] #![allow(deprecated)] // rand extern crate core; diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index baad31a61e105..1c7e97d784c68 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -25,7 +25,6 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(int_uint)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(unicode)] diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index a3cae259fd3e5..ca184fb8736cd 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -91,7 +91,6 @@ #![deny(missing_docs)] #![feature(collections)] #![feature(int_uint)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![cfg_attr(test, feature(rustc_private))] diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 2d94ddaef1835..a1a271bc5abb5 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -273,7 +273,6 @@ #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(slicing_syntax)] #![feature(int_uint)] #![feature(collections)] #![feature(core)] diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index 1fedf49738cdf..5edb4a96a7df6 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -168,7 +168,6 @@ #![deny(missing_docs)] #![feature(staged_api)] -#![feature(slicing_syntax)] #![feature(box_syntax)] #![feature(int_uint)] #![feature(core)] diff --git a/src/librbml/lib.rs b/src/librbml/lib.rs index 20af4dadfcae9..154dbbdb75034 100644 --- a/src/librbml/lib.rs +++ b/src/librbml/lib.rs @@ -30,7 +30,6 @@ #![feature(int_uint)] #![feature(io)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] extern crate serialize; diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index a4c4ea5438691..f060d464e410f 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -36,7 +36,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 50a68e8f1e342..9b8ca398b12b8 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -35,7 +35,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 848c3557b1bdb..874c8f2a9402d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -24,7 +24,6 @@ #![feature(int_uint)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] diff --git a/src/librustc_trans/lib.rs b/src/librustc_trans/lib.rs index c4d1416d975cc..21557379e3ae2 100644 --- a/src/librustc_trans/lib.rs +++ b/src/librustc_trans/lib.rs @@ -37,7 +37,7 @@ #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index ccfadaba2440b..7498dc8179d75 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -83,7 +83,7 @@ This API is completely unstable and subject to change. #![feature(quote)] #![feature(rustc_diagnostic_macros)] #![feature(rustc_private)] -#![feature(slicing_syntax, unsafe_destructor)] +#![feature(unsafe_destructor)] #![feature(staged_api)] #[macro_use] extern crate log; diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 9d45caf76696a..b09c3f730fc64 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -30,7 +30,6 @@ #![feature(os)] #![feature(path)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(test)] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index 4579d1f19d3f0..6cada2e5614ba 100644 --- a/src/libserialize/lib.rs +++ b/src/libserialize/lib.rs @@ -33,7 +33,6 @@ Core encoding and decoding interfaces. #![feature(path)] #![feature(hash)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index 5f1089bc63b99..8dc19047de08e 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -32,7 +32,6 @@ use sys_common; /// /// ```rust,no_run /// # #![allow(unused_must_use)] -/// #![feature(slicing_syntax)] /// /// use std::old_io::net::udp::UdpSocket; /// use std::old_io::net::ip::{Ipv4Addr, SocketAddr}; diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 951e4dcf79254..f4b0c867f42c6 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -35,7 +35,6 @@ #![feature(path)] #![feature(quote, unsafe_destructor)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index 1bb038603c39c..c4b3d2813afe4 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -57,7 +57,6 @@ #![feature(io)] #![feature(path)] #![feature(rustc_private)] -#![feature(slicing_syntax)] #![feature(staged_api)] #![feature(std_misc)] #![feature(unicode)] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index cc468df87f383..860ce209d451f 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -32,7 +32,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] -#![feature(asm, slicing_syntax)] +#![feature(asm)] #![feature(box_syntax)] #![feature(collections)] #![feature(core)] diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 977cb783344e3..89b310d494971 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -31,7 +31,6 @@ html_playground_url = "http://play.rust-lang.org/")] #![feature(no_std)] #![no_std] -#![feature(slicing_syntax)] #![feature(core)] extern crate core; diff --git a/src/rustbook/main.rs b/src/rustbook/main.rs index 3e571bad09ca4..b29538ad62078 100644 --- a/src/rustbook/main.rs +++ b/src/rustbook/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(slicing_syntax, box_syntax)] +#![feature(box_syntax)] #![feature(collections)] #![feature(core)] #![feature(io)] diff --git a/src/test/run-pass/ranges-precedence.rs b/src/test/run-pass/ranges-precedence.rs index cd49094851695..db414abb7ffc8 100644 --- a/src/test/run-pass/ranges-precedence.rs +++ b/src/test/run-pass/ranges-precedence.rs @@ -10,7 +10,6 @@ // Test that the precedence of ranges is correct -#![feature(slicing_syntax)] struct Foo { foo: uint, From cea2bbfe27707becaacad1ce64b835b408c0ccf8 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 15 Feb 2015 22:20:38 +0530 Subject: [PATCH 54/54] Fix grammar --- src/doc/grammar.md | 2 +- src/doc/trpl/ffi.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/grammar.md b/src/doc/grammar.md index 9124328b8eee9..d7a29ea530952 100644 --- a/src/doc/grammar.md +++ b/src/doc/grammar.md @@ -568,7 +568,7 @@ binop_expr : expr binop expr ; The precedence of Rust binary operators is ordered as follows, going from strong to weak: -``` +```text * / % as + - diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md index 5375a8aa46b30..f2b95f19edce2 100644 --- a/src/doc/trpl/ffi.md +++ b/src/doc/trpl/ffi.md @@ -439,7 +439,7 @@ fn main() { unsafe { rl_prompt = prompt.as_ptr(); - println!("{}", rl_prompt); + println!("{:?}", rl_prompt); rl_prompt = ptr::null(); }