]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #31931 - Luke-Nukem:master, r=steveklabnik
authorbors <bors@rust-lang.org>
Sat, 27 Feb 2016 20:26:59 +0000 (20:26 +0000)
committerbors <bors@rust-lang.org>
Sat, 27 Feb 2016 20:26:59 +0000 (20:26 +0000)
 Refinement of paragraph referenced by [this issue](https://github.com/rust-lang/rust/issues/31927).

The paragraph in question had been adjusted already, but I've made some further clarifications which should help with readability and not leave the reader any `dangling pointers`.

23 files changed:
RELEASES.md
src/doc/book/const-and-static.md
src/doc/reference.md
src/libcollections/str.rs
src/libcore/num/flt2dec/mod.rs
src/libcoretest/lib.rs
src/libcoretest/num/flt2dec/mod.rs
src/librbml/lib.rs
src/librustc/lib.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/subst.rs
src/librustc_back/lib.rs
src/librustc_back/sha2.rs
src/librustc_driver/pretty.rs
src/libstd/io/cursor.rs
src/libstd/io/impls.rs
src/libstd/lib.rs
src/libstd/net/parser.rs
src/libstd/primitive_docs.rs
src/libstd/sys/common/wtf8.rs
src/test/compile-fail/mir-unpretty.rs [new file with mode: 0644]

index a247eb2e9555c999f08c6edc2e7eb4b50671d498..d279378a2dd45292e88a61d4d56b07f806260197 100644 (file)
@@ -75,8 +75,8 @@ Libraries
   improved by using `memchr` to search for newlines][1.7m].
 * [`f32::to_degrees` and `f32::to_radians` are stable][1.7f]. The
   `f64` variants were stabilized previously.
-* [`BTreeMap` was rewritten to use less memory improve performance of
-  insertion and iteration, the latter by as much as 5x`][1.7bm].
+* [`BTreeMap` was rewritten to use less memory and improve the performance
+  of insertion and iteration, the latter by as much as 5x`][1.7bm].
 * [`BTreeSet` and its iterators, `Iter`, `IntoIter`, and `Range` are
   covariant over their contained type][1.7bt].
 * [`LinkedList` and its iterators, `Iter` and `IntoIter` are covariant
index 7d555b52a986df0329f7f1d42877ddc85aa15089..b7042854bd27fc0248c47cdf769cf1c1a4fe7f67 100644 (file)
@@ -64,16 +64,16 @@ unsafe {
 
 [unsafe]: unsafe.html
 
-Furthermore, any type stored in a `static` must be `Sync`, and may not have
+Furthermore, any type stored in a `static` must be `Sync`, and must not have
 a [`Drop`][drop] implementation.
 
 [drop]: drop.html
 
 # Initializing
 
-Both `const` and `static` have requirements for giving them a value. They may
-only be given a value that’s a constant expression. In other words, you cannot
-use the result of a function call or anything similarly complex or at runtime.
+Both `const` and `static` have requirements for giving them a value. They must
+be given a value that’s a constant expression. In other words, you cannot use 
+the result of a function call or anything similarly complex or at runtime.
 
 # Which construct should I use?
 
index 6262618a030a3f7be0bda63d078e717c39281720..913cfcff104af0f87439962c0d5220ccaffe9449 100644 (file)
@@ -3040,7 +3040,7 @@ the case of a `while` loop, the head is the conditional expression controlling
 the loop. In the case of a `for` loop, the head is the call-expression
 controlling the loop. If the label is present, then `continue 'foo` returns
 control to the head of the loop with label `'foo`, which need not be the
-innermost label enclosing the `break` expression, but must enclose it.
+innermost label enclosing the `continue` expression, but must enclose it.
 
 A `continue` expression is only permitted in the body of a loop.
 
index 89b5e5b30755c11c11a531a626231398478b8a53..5f3df398f16ba4802a32a32ae6b53ec9469fc7ac 100644 (file)
@@ -267,9 +267,11 @@ pub fn as_bytes(&self) -> &[u8] {
     /// Converts a string slice to a raw pointer.
     ///
     /// As string slices are a slice of bytes, the raw pointer points to a
-    /// `u8`. This pointer will be pointing to the first byte of the string
+    /// [`u8`]. This pointer will be pointing to the first byte of the string
     /// slice.
     ///
+    /// [`u8`]: primitive.u8.html
+    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -661,7 +663,7 @@ pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) {
     /// assert_eq!(None, chars.next());
     /// ```
     ///
-    /// Remember, `char`s may not match your human intuition about characters:
+    /// Remember, [`char`]s may not match your human intuition about characters:
     ///
     /// ```
     /// let y = "y̆";
@@ -678,16 +680,18 @@ pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) {
     pub fn chars(&self) -> Chars {
         core_str::StrExt::chars(self)
     }
-    /// Returns an iterator over the `char`s of a string slice, and their
+    /// Returns an iterator over the [`char`]s of a string slice, and their
     /// positions.
     ///
     /// As a string slice consists of valid UTF-8, we can iterate through a
-    /// string slice by `char`. This method returns an iterator of both
-    /// these `char`s, as well as their byte positions.
+    /// string slice by [`char`]. This method returns an iterator of both
+    /// these [`char`]s, as well as their byte positions.
     ///
-    /// The iterator yields tuples. The position is first, the `char` is
+    /// The iterator yields tuples. The position is first, the [`char`] is
     /// second.
     ///
+    /// [`char`]: primitive.char.html
+    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -711,7 +715,7 @@ pub fn chars(&self) -> Chars {
     /// assert_eq!(None, char_indices.next());
     /// ```
     ///
-    /// Remember, `char`s may not match your human intuition about characters:
+    /// Remember, [`char`]s may not match your human intuition about characters:
     ///
     /// ```
     /// let y = "y̆";
@@ -918,12 +922,13 @@ pub fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool
     /// Returns the byte index of the first character of this string slice that
     /// matches the pattern.
     ///
-    /// Returns `None` if the pattern doesn't match.
+    /// Returns [`None`] if the pattern doesn't match.
     ///
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
     /// [`char`]: primitive.char.html
+    /// [`None`]: option/enum.Option.html#variant.None
     ///
     /// # Examples
     ///
@@ -962,12 +967,13 @@ pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize> {
     /// Returns the byte index of the last character of this string slice that
     /// matches the pattern.
     ///
-    /// Returns `None` if the pattern doesn't match.
+    /// Returns [`None`] if the pattern doesn't match.
     ///
     /// The pattern can be a `&str`, [`char`], or a closure that determines if
     /// a character matches.
     ///
     /// [`char`]: primitive.char.html
+    /// [`None`]: option/enum.Option.html#variant.None
     ///
     /// # Examples
     ///
@@ -1187,14 +1193,18 @@ pub fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator
     /// An iterator over substrings of `self`, separated by characters
     /// matched by a pattern and yielded in reverse order.
     ///
-    /// The pattern can be a simple `&str`, `char`, or a closure that
+    /// The pattern can be a simple `&str`, [`char`], or a closure that
     /// determines the split.
     /// Additional libraries might provide more complex patterns like
     /// regular expressions.
     ///
-    /// Equivalent to `split`, except that the trailing substring is
+    /// [`char`]: primitive.char.html
+    ///
+    /// Equivalent to [`split()`], except that the trailing substring is
     /// skipped if empty.
     ///
+    /// [`split()`]: #method.split
+    ///
     /// This method can be used for string data that is _terminated_,
     /// rather than _separated_ by a pattern.
     ///
@@ -1457,7 +1467,7 @@ pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P
     /// # Iterator behavior
     ///
     /// The returned iterator requires that the pattern supports a reverse
-    /// search, and it will be a `[DoubleEndedIterator]` if a forward/reverse
+    /// search, and it will be a [`DoubleEndedIterator`] if a forward/reverse
     /// search yields the same elements.
     ///
     /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html
@@ -1694,9 +1704,11 @@ pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
     ///
     /// # Errors
     ///
-    /// Will return `Err` if it's not possible to parse this string slice into
+    /// Will return [`Err`] if it's not possible to parse this string slice into
     /// the desired type.
     ///
+    /// [`Err`]: str/trait.FromStr.html#associatedtype.Err
+    ///
     /// # Example
     ///
     /// Basic usage
@@ -1707,7 +1719,7 @@ pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
     /// assert_eq!(4, four);
     /// ```
     ///
-    /// Using the 'turbofish' instead of annotationg `four`:
+    /// Using the 'turbofish' instead of annotating `four`:
     ///
     /// ```
     /// let four = "4".parse::<u32>();
@@ -1765,11 +1777,13 @@ pub fn replace<'a, P: Pattern<'a>>(&'a self, from: P, to: &str) -> String {
         result
     }
 
-    /// Returns the lowercase equivalent of this string slice, as a new `String`.
+    /// Returns the lowercase equivalent of this string slice, as a new [`String`].
     ///
     /// 'Lowercase' is defined according to the terms of the Unicode Derived Core Property
     /// `Lowercase`.
     ///
+    /// [`String`]: string/struct.String.html
+    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -1839,11 +1853,13 @@ fn case_ignoreable_then_cased<I: Iterator<Item = char>>(iter: I) -> bool {
         }
     }
 
-    /// Returns the uppercase equivalent of this string slice, as a new `String`.
+    /// Returns the uppercase equivalent of this string slice, as a new [`String`].
     ///
     /// 'Uppercase' is defined according to the terms of the Unicode Derived Core Property
     /// `Uppercase`.
     ///
+    /// [`String`]: string/struct.String.html
+    ///
     /// # Examples
     ///
     /// Basic usage:
@@ -1884,7 +1900,9 @@ pub fn escape_unicode(&self) -> String {
         self.chars().flat_map(|c| c.escape_unicode()).collect()
     }
 
-    /// Converts a `Box<str>` into a `String` without copying or allocating.
+    /// Converts a `Box<str>` into a [`String`] without copying or allocating.
+    ///
+    /// [`String`]: string/struct.String.html
     ///
     /// # Examples
     ///
index 9f7672a52a1832d6d572b69be20c7410dbb1e86a..b9a7afc400d5e7a8e854ff5fd1ed5e4a78971284 100644 (file)
@@ -210,7 +210,7 @@ pub fn write(&self, out: &mut [u8]) -> Option<usize> {
                     }
                 }
                 Part::Copy(buf) => {
-                    out[..buf.len()].clone_from_slice(buf);
+                    out[..buf.len()].copy_from_slice(buf);
                 }
             }
             Some(len)
@@ -245,7 +245,7 @@ pub fn len(&self) -> usize {
     /// (It may still leave partially written bytes in the buffer; do not rely on that.)
     pub fn write(&self, out: &mut [u8]) -> Option<usize> {
         if out.len() < self.sign.len() { return None; }
-        out[..self.sign.len()].clone_from_slice(self.sign);
+        out[..self.sign.len()].copy_from_slice(self.sign);
 
         let mut written = self.sign.len();
         for part in self.parts {
index f23ddea5cc99d187ee0f397ad967b3aa5553e48a..e4df99002c8c23116f58249929565ca6c5b3c76e 100644 (file)
@@ -15,6 +15,7 @@
 #![feature(box_syntax)]
 #![feature(cell_extras)]
 #![feature(const_fn)]
+#![feature(copy_from_slice)]
 #![feature(core_float)]
 #![feature(core_private_bignum)]
 #![feature(core_private_diy_float)]
index 48a5501acb79114c92e91bb4aef2e865ec2057d1..1a592f3ad4249f3489cffec79b70bb8e01bc9432 100644 (file)
@@ -100,7 +100,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
 
     // check significant digits
     for i in 1..cut.unwrap_or(expected.len() - 1) {
-        expected_[..i].clone_from_slice(&expected[..i]);
+        expected_[..i].copy_from_slice(&expected[..i]);
         let mut expectedk_ = expectedk;
         if expected[i] >= b'5' {
             // check if this is a rounding-to-even case.
@@ -147,7 +147,7 @@ fn check_exact<F, T>(mut f: F, v: T, vstr: &str, expected: &[u8], expectedk: i16
     // check infinite zero digits
     if let Some(cut) = cut {
         for i in cut..expected.len()-1 {
-            expected_[..cut].clone_from_slice(&expected[..cut]);
+            expected_[..cut].copy_from_slice(&expected[..cut]);
             for c in &mut expected_[cut..i] { *c = b'0'; }
 
             try_exact!(f(&decoded) => &mut buf, &expected_[..i], expectedk;
index 1727fa2a0d34ad382876850dd0d55ccd28ff7099..533f2ee3b3e614c8be1429297815c598544a411a 100644 (file)
        test(attr(deny(warnings))))]
 #![cfg_attr(not(stage0), deny(warnings))]
 
+#![feature(copy_from_slice)]
 #![feature(rustc_private)]
 #![feature(staged_api)]
 
@@ -519,7 +520,7 @@ pub fn doc_as_u64(d: Doc) -> u64 {
             // of the page and segfault.
 
             let mut b = [0; 8];
-            b.clone_from_slice(&d.data[d.end - 8..d.end]);
+            b.copy_from_slice(&d.data[d.end - 8..d.end]);
             let data = unsafe { (*(b.as_ptr() as *const u64)).to_be() };
             let len = d.end - d.start;
             if len < 8 {
@@ -1043,7 +1044,7 @@ pub fn end_tag(&mut self) -> EncodeResult {
                 {
                     let last_size_pos = last_size_pos as usize;
                     let data = &self.writer.get_ref()[last_size_pos + 4..cur_pos as usize];
-                    buf[..size].clone_from_slice(data);
+                    buf[..size].copy_from_slice(data);
                 }
 
                 // overwrite the size and data and continue
index bd256d19b6725653a302f979089fbc389c62d620..712afd00d46869a2b3666491c64b33c73dc7463a 100644 (file)
@@ -29,6 +29,7 @@
 #![feature(cell_extras)]
 #![feature(collections)]
 #![feature(const_fn)]
+#![feature(copy_from_slice)]
 #![feature(enumset)]
 #![feature(iter_arith)]
 #![feature(libc)]
index ea74e74a863cf21cfba900c23a50f4e5318db15c..d138ab101b524c81f1daa80f0cd8d547ffcc2253 100644 (file)
@@ -766,6 +766,7 @@ fn visit_foreign_item(&mut self, it: &hir::ForeignItem) {
         self.with_lint_attrs(&it.attrs, |cx| {
             run_lints!(cx, check_foreign_item, late_passes, it);
             hir_visit::walk_foreign_item(cx, it);
+            run_lints!(cx, check_foreign_item_post, late_passes, it);
         })
     }
 
@@ -795,6 +796,7 @@ fn visit_fn(&mut self, fk: hir_visit::FnKind<'v>, decl: &'v hir::FnDecl,
                 body: &'v hir::Block, span: Span, id: ast::NodeId) {
         run_lints!(self, check_fn, late_passes, fk, decl, body, span, id);
         hir_visit::walk_fn(self, fk, decl, body, span);
+        run_lints!(self, check_fn_post, late_passes, fk, decl, body, span, id);
     }
 
     fn visit_variant_data(&mut self,
@@ -835,6 +837,7 @@ fn visit_name(&mut self, sp: Span, name: ast::Name) {
     fn visit_mod(&mut self, m: &hir::Mod, s: Span, n: ast::NodeId) {
         run_lints!(self, check_mod, late_passes, m, s, n);
         hir_visit::walk_mod(self, m);
+        run_lints!(self, check_mod_post, late_passes, m, s, n);
     }
 
     fn visit_local(&mut self, l: &hir::Local) {
@@ -874,6 +877,7 @@ fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) {
             run_lints!(cx, check_trait_item, late_passes, trait_item);
             cx.visit_ids(|v| v.visit_trait_item(trait_item));
             hir_visit::walk_trait_item(cx, trait_item);
+            run_lints!(cx, check_trait_item_post, late_passes, trait_item);
         });
     }
 
@@ -882,6 +886,7 @@ fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) {
             run_lints!(cx, check_impl_item, late_passes, impl_item);
             cx.visit_ids(|v| v.visit_impl_item(impl_item));
             hir_visit::walk_impl_item(cx, impl_item);
+            run_lints!(cx, check_impl_item_post, late_passes, impl_item);
         });
     }
 
@@ -928,6 +933,7 @@ fn visit_foreign_item(&mut self, it: &ast::ForeignItem) {
         self.with_lint_attrs(&it.attrs, |cx| {
             run_lints!(cx, check_foreign_item, early_passes, it);
             ast_visit::walk_foreign_item(cx, it);
+            run_lints!(cx, check_foreign_item_post, early_passes, it);
         })
     }
 
@@ -952,6 +958,7 @@ fn visit_fn(&mut self, fk: ast_visit::FnKind<'v>, decl: &'v ast::FnDecl,
                 body: &'v ast::Block, span: Span, id: ast::NodeId) {
         run_lints!(self, check_fn, early_passes, fk, decl, body, span, id);
         ast_visit::walk_fn(self, fk, decl, body, span);
+        run_lints!(self, check_fn_post, early_passes, fk, decl, body, span, id);
     }
 
     fn visit_variant_data(&mut self,
@@ -992,6 +999,7 @@ fn visit_ident(&mut self, sp: Span, id: ast::Ident) {
     fn visit_mod(&mut self, m: &ast::Mod, s: Span, n: ast::NodeId) {
         run_lints!(self, check_mod, early_passes, m, s, n);
         ast_visit::walk_mod(self, m);
+        run_lints!(self, check_mod_post, early_passes, m, s, n);
     }
 
     fn visit_local(&mut self, l: &ast::Local) {
@@ -1031,6 +1039,7 @@ fn visit_trait_item(&mut self, trait_item: &ast::TraitItem) {
             run_lints!(cx, check_trait_item, early_passes, trait_item);
             cx.visit_ids(|v| v.visit_trait_item(trait_item));
             ast_visit::walk_trait_item(cx, trait_item);
+            run_lints!(cx, check_trait_item_post, early_passes, trait_item);
         });
     }
 
@@ -1039,6 +1048,7 @@ fn visit_impl_item(&mut self, impl_item: &ast::ImplItem) {
             run_lints!(cx, check_impl_item, early_passes, impl_item);
             cx.visit_ids(|v| v.visit_impl_item(impl_item));
             ast_visit::walk_impl_item(cx, impl_item);
+            run_lints!(cx, check_impl_item_post, early_passes, impl_item);
         });
     }
 
index 5e2e8c4c6d5f8877cf02e1f5df72efbb64f2c564..133d0163a8c9b9d568d716359152d7e3af188ac0 100644 (file)
@@ -134,7 +134,9 @@ fn check_name(&mut self, _: &LateContext, _: Span, _: ast::Name) { }
     fn check_crate(&mut self, _: &LateContext, _: &hir::Crate) { }
     fn check_crate_post(&mut self, _: &LateContext, _: &hir::Crate) { }
     fn check_mod(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
+    fn check_mod_post(&mut self, _: &LateContext, _: &hir::Mod, _: Span, _: ast::NodeId) { }
     fn check_foreign_item(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
+    fn check_foreign_item_post(&mut self, _: &LateContext, _: &hir::ForeignItem) { }
     fn check_item(&mut self, _: &LateContext, _: &hir::Item) { }
     fn check_item_post(&mut self, _: &LateContext, _: &hir::Item) { }
     fn check_local(&mut self, _: &LateContext, _: &hir::Local) { }
@@ -150,8 +152,12 @@ fn check_ty(&mut self, _: &LateContext, _: &hir::Ty) { }
     fn check_generics(&mut self, _: &LateContext, _: &hir::Generics) { }
     fn check_fn(&mut self, _: &LateContext,
         _: FnKind, _: &hir::FnDecl, _: &hir::Block, _: Span, _: ast::NodeId) { }
+    fn check_fn_post(&mut self, _: &LateContext,
+        _: FnKind, _: &hir::FnDecl, _: &hir::Block, _: Span, _: ast::NodeId) { }
     fn check_trait_item(&mut self, _: &LateContext, _: &hir::TraitItem) { }
+    fn check_trait_item_post(&mut self, _: &LateContext, _: &hir::TraitItem) { }
     fn check_impl_item(&mut self, _: &LateContext, _: &hir::ImplItem) { }
+    fn check_impl_item_post(&mut self, _: &LateContext, _: &hir::ImplItem) { }
     fn check_struct_def(&mut self, _: &LateContext,
         _: &hir::VariantData, _: ast::Name, _: &hir::Generics, _: ast::NodeId) { }
     fn check_struct_def_post(&mut self, _: &LateContext,
@@ -179,7 +185,9 @@ fn check_ident(&mut self, _: &EarlyContext, _: Span, _: ast::Ident) { }
     fn check_crate(&mut self, _: &EarlyContext, _: &ast::Crate) { }
     fn check_crate_post(&mut self, _: &EarlyContext, _: &ast::Crate) { }
     fn check_mod(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
+    fn check_mod_post(&mut self, _: &EarlyContext, _: &ast::Mod, _: Span, _: ast::NodeId) { }
     fn check_foreign_item(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
+    fn check_foreign_item_post(&mut self, _: &EarlyContext, _: &ast::ForeignItem) { }
     fn check_item(&mut self, _: &EarlyContext, _: &ast::Item) { }
     fn check_item_post(&mut self, _: &EarlyContext, _: &ast::Item) { }
     fn check_local(&mut self, _: &EarlyContext, _: &ast::Local) { }
@@ -195,8 +203,12 @@ fn check_ty(&mut self, _: &EarlyContext, _: &ast::Ty) { }
     fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
     fn check_fn(&mut self, _: &EarlyContext,
         _: ast_visit::FnKind, _: &ast::FnDecl, _: &ast::Block, _: Span, _: ast::NodeId) { }
+    fn check_fn_post(&mut self, _: &EarlyContext,
+        _: ast_visit::FnKind, _: &ast::FnDecl, _: &ast::Block, _: Span, _: ast::NodeId) { }
     fn check_trait_item(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
+    fn check_trait_item_post(&mut self, _: &EarlyContext, _: &ast::TraitItem) { }
     fn check_impl_item(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
+    fn check_impl_item_post(&mut self, _: &EarlyContext, _: &ast::ImplItem) { }
     fn check_struct_def(&mut self, _: &EarlyContext,
         _: &ast::VariantData, _: ast::Ident, _: &ast::Generics, _: ast::NodeId) { }
     fn check_struct_def_post(&mut self, _: &EarlyContext,
index 933857269cbcd82f99d218d53b3140b053c66148..3fc45c575f0454682edf081448a1dd9499a9319d 100644 (file)
@@ -489,7 +489,7 @@ pub fn add_kills_from_flow_exits(&mut self, cfg: &cfg::CFG) {
                 let bits = &mut self.scope_kills[start.. end];
                 debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [before]",
                        self.analysis_name, flow_exit, mut_bits_to_string(bits));
-                bits.clone_from_slice(&orig_kills[..]);
+                bits.copy_from_slice(&orig_kills[..]);
                 debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [after]",
                        self.analysis_name, flow_exit, mut_bits_to_string(bits));
             }
@@ -556,7 +556,7 @@ fn walk_cfg(&mut self,
             let (start, end) = self.dfcx.compute_id_range(node_index);
 
             // Initialize local bitvector with state on-entry.
-            in_out.clone_from_slice(&self.dfcx.on_entry[start.. end]);
+            in_out.copy_from_slice(&self.dfcx.on_entry[start.. end]);
 
             // Compute state on-exit by applying transfer function to
             // state on-entry.
index ddc817ffc023e0ee5c40c8436367334f6ff9cba9..f8c6d3d934123bb0b38f2ac9e18a1fc6fc56be14 100644 (file)
@@ -555,6 +555,11 @@ fn next(&mut self) -> Option<(ParamSpace, usize, &'a T)> {
             None
         }
     }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        let size = self.vec.as_slice().len();
+        (size, Some(size))
+    }
 }
 
 impl<T> IntoIterator for VecPerParamSpace<T> {
index 4d8cfc23804203b786a0c98534233d63cfa5236f..364c2977bfb057fca7c45071befc3ba22e9e063c 100644 (file)
@@ -31,6 +31,7 @@
 #![cfg_attr(not(stage0), deny(warnings))]
 
 #![feature(box_syntax)]
+#![feature(copy_from_slice)]
 #![feature(libc)]
 #![feature(rand)]
 #![feature(rustc_private)]
index 840f9abce9363f1a80f844ab716c21e884aa3a22..ba8107e03c9f76fcd153b01a4b8aab2b212c23ba 100644 (file)
@@ -134,13 +134,13 @@ fn input<F>(&mut self, input: &[u8], mut func: F) where
             let buffer_remaining = size - self.buffer_idx;
             if input.len() >= buffer_remaining {
                 self.buffer[self.buffer_idx..size]
-                    .clone_from_slice(&input[..buffer_remaining]);
+                    .copy_from_slice(&input[..buffer_remaining]);
                 self.buffer_idx = 0;
                 func(&self.buffer);
                 i += buffer_remaining;
             } else {
                 self.buffer[self.buffer_idx..self.buffer_idx + input.len()]
-                    .clone_from_slice(input);
+                    .copy_from_slice(input);
                 self.buffer_idx += input.len();
                 return;
             }
@@ -157,7 +157,7 @@ fn input<F>(&mut self, input: &[u8], mut func: F) where
         // data left in the input vector will be less than the buffer size and the buffer will
         // be empty.
         let input_remaining = input.len() - i;
-        self.buffer[..input_remaining].clone_from_slice(&input[i..]);
+        self.buffer[..input_remaining].copy_from_slice(&input[i..]);
         self.buffer_idx += input_remaining;
     }
 
index 0517357892161c6ffdb1da1bbeb460841292f88d..e9db30f3cb24fd37363c2423663fbe7afc7558c6 100644 (file)
@@ -817,13 +817,12 @@ pub fn pretty_print_input(sess: Session,
                                                              &id,
                                                              resolve::MakeGlobMap::No,
                                                              |tcx, mir_map, _, _| {
-                let mir_map = mir_map.unwrap();
-
-                for (nodeid, mir) in &mir_map.map {
-                    try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(*nodeid)));
-                    try!(write_mir_pretty(mir, &mut out));
+                if let Some(mir_map) = mir_map {
+                    for (nodeid, mir) in &mir_map.map {
+                        try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(*nodeid)));
+                        try!(write_mir_pretty(mir, &mut out));
+                    }
                 }
-
                 Ok(())
             }), &sess)
         }
@@ -840,12 +839,14 @@ pub fn pretty_print_input(sess: Session,
                                                              &id,
                                                              resolve::MakeGlobMap::No,
                                                              |tcx, mir_map, _, _| {
-                let mir_map = mir_map.unwrap();
-                try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(nodeid)));
-                let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
-                    sess.fatal(&format!("no MIR map entry for node {}", nodeid))
-                });
-                write_mir_pretty(mir, &mut out)
+                if let Some(mir_map) = mir_map {
+                    try!(writeln!(out, "MIR for {}", tcx.map.node_to_string(nodeid)));
+                    let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
+                        sess.fatal(&format!("no MIR map entry for node {}", nodeid))
+                    });
+                    try!(write_mir_pretty(mir, &mut out));
+                }
+                Ok(())
             }), &sess)
         }
 
index 4573f46581969f767a2b4edbf528d3354b858aab..420fede34d2f835cd4dbca5daeffa42e93c48ebe 100644 (file)
@@ -256,7 +256,7 @@ fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
             let pos = pos as usize;
             let space = self.inner.len() - pos;
             let (left, right) = buf.split_at(cmp::min(space, buf.len()));
-            self.inner[pos..pos + left.len()].clone_from_slice(left);
+            self.inner[pos..pos + left.len()].copy_from_slice(left);
             self.inner.extend_from_slice(right);
         }
 
index 592e16b0a3c090f54d456276864d5c0ee646c164..ec63f14d4533217a21a1bd6ca28af70c8a278bf4 100644 (file)
@@ -156,7 +156,7 @@ impl<'a> Read for &'a [u8] {
     fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
         let amt = cmp::min(buf.len(), self.len());
         let (a, b) = self.split_at(amt);
-        buf[..amt].clone_from_slice(a);
+        buf[..amt].copy_from_slice(a);
         *self = b;
         Ok(amt)
     }
@@ -168,7 +168,7 @@ fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
                                   "failed to fill whole buffer"));
         }
         let (a, b) = self.split_at(buf.len());
-        buf.clone_from_slice(a);
+        buf.copy_from_slice(a);
         *self = b;
         Ok(())
     }
@@ -189,7 +189,7 @@ impl<'a> Write for &'a mut [u8] {
     fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         let amt = cmp::min(data.len(), self.len());
         let (a, b) = mem::replace(self, &mut []).split_at_mut(amt);
-        a.clone_from_slice(&data[..amt]);
+        a.copy_from_slice(&data[..amt]);
         *self = b;
         Ok(amt)
     }
index d8ecddcbe422c6ff20f7daab0f955c031b7b562c..f9e7c1fede24e798c01cc56087a87c8d6ed1c1e9 100644 (file)
 #![feature(collections)]
 #![feature(collections_bound)]
 #![feature(const_fn)]
+#![feature(copy_from_slice)]
 #![feature(core_float)]
 #![feature(core_intrinsics)]
 #![feature(decode_utf16)]
index 63eee6bcfded5fa5afef655d197f649f6b4d80e4..5851ce7135d2745c08faf78a6c990029db2fdbba 100644 (file)
@@ -191,8 +191,8 @@ fn read_ipv6_addr_impl(&mut self) -> Option<Ipv6Addr> {
         fn ipv6_addr_from_head_tail(head: &[u16], tail: &[u16]) -> Ipv6Addr {
             assert!(head.len() + tail.len() <= 8);
             let mut gs = [0; 8];
-            gs[..head.len()].clone_from_slice(head);
-            gs[(8 - tail.len()) .. 8].clone_from_slice(tail);
+            gs[..head.len()].copy_from_slice(head);
+            gs[(8 - tail.len()) .. 8].copy_from_slice(tail);
             Ipv6Addr::new(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
         }
 
index e5819522123c409b7de1b227911afede51bf0c74..839287d13217bed2e7a98da483dc56ceba551d59 100644 (file)
@@ -488,6 +488,9 @@ mod prim_tuple { }
 ///
 /// *[See also the `std::f32` module](f32/index.html).*
 ///
+/// However, please note that examples are shared between the `f64` and `f32`
+/// primitive types. So it's normal if you see usage of `f64` in there.
+///
 mod prim_f32 { }
 
 #[doc(primitive = "f64")]
@@ -496,6 +499,9 @@ mod prim_f32 { }
 ///
 /// *[See also the `std::f64` module](f64/index.html).*
 ///
+/// However, please note that examples are shared between the `f64` and `f32`
+/// primitive types. So it's normal if you see usage of `f32` in there.
+///
 mod prim_f64 { }
 
 #[doc(primitive = "i8")]
index 68ba2fe20b4b3434579ed4568071f5bd0af79d98..48e9adb9296bc47b7888fa981193b126c0947f0e 100644 (file)
@@ -341,7 +341,7 @@ pub fn into_string_lossy(mut self) -> String {
                 Some((surrogate_pos, _)) => {
                     pos = surrogate_pos + 3;
                     self.bytes[surrogate_pos..pos]
-                        .clone_from_slice(UTF8_REPLACEMENT_CHARACTER);
+                        .copy_from_slice(UTF8_REPLACEMENT_CHARACTER);
                 },
                 None => return unsafe { String::from_utf8_unchecked(self.bytes) }
             }
diff --git a/src/test/compile-fail/mir-unpretty.rs b/src/test/compile-fail/mir-unpretty.rs
new file mode 100644 (file)
index 0000000..8950bef
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z unstable-options --unpretty=mir
+
+fn main() {
+    let x: () = 0; //~ ERROR: mismatched types
+}