]> git.lizzy.rs Git - rust.git/commitdiff
Fallout from stabilization
authorAaron Turon <aturon@mozilla.com>
Tue, 30 Dec 2014 18:51:18 +0000 (10:51 -0800)
committerAaron Turon <aturon@mozilla.com>
Wed, 31 Dec 2014 01:06:08 +0000 (17:06 -0800)
78 files changed:
src/compiletest/runtest.rs
src/liballoc/arc.rs
src/libcollections/binary_heap.rs
src/libcollections/bit.rs
src/libcollections/btree/node.rs
src/libcollections/dlist.rs
src/libcollections/lib.rs
src/libcollections/ring_buf.rs
src/libcollections/slice.rs
src/libcollections/str.rs
src/libcollections/string.rs
src/libcollections/vec.rs
src/libcollections/vec_map.rs
src/libcore/iter.rs
src/libcore/slice.rs
src/libcoretest/slice.rs
src/libgetopts/lib.rs
src/librand/isaac.rs
src/librbml/io.rs
src/libregex/compile.rs
src/libregex/parse.rs
src/libregex/vm.rs
src/librustc/metadata/encoder.rs
src/librustc/middle/check_match.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/infer/error_reporting.rs
src/librustc/middle/infer/mod.rs
src/librustc/middle/infer/region_inference/mod.rs
src/librustc/middle/liveness.rs
src/librustc/middle/privacy.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/subst.rs
src/librustc/util/lev_distance.rs
src/librustc_back/sha2.rs
src/librustc_borrowck/borrowck/fragments.rs
src/librustc_borrowck/lib.rs
src/librustc_driver/lib.rs
src/librustc_resolve/lib.rs
src/librustc_trans/trans/_match.rs
src/librustc_trans/trans/cabi_x86_64.rs
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/type_.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionmanip.rs
src/librustc_typeck/rscope.rs
src/librustc_typeck/variance.rs
src/librustdoc/html/format.rs
src/librustdoc/html/render.rs
src/libstd/c_str.rs
src/libstd/comm/sync.rs
src/libstd/io/buffered.rs
src/libstd/os.rs
src/libstd/path/posix.rs
src/libstd/path/windows.rs
src/libstd/rt/args.rs
src/libstd/sys/unix/timer.rs
src/libstd/sys/windows/os.rs
src/libstd/sys/windows/tty.rs
src/libsyntax/ast_map/mod.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/format.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/print/pp.rs
src/libsyntax/std_inject.rs
src/libterm/terminfo/parm.rs
src/libtest/lib.rs
src/libunicode/normalize.rs
src/libunicode/tables.rs
src/rust-installer
src/test/bench/core-std.rs
src/test/bench/shootout-reverse-complement.rs
src/test/compile-fail/issue-15756.rs
src/test/compile-fail/resolve-conflict-type-vs-import.rs

index 1abcd8bd214075ecd264622abeea789b207264ab..d52de12ff5b292e7e9be43557755ea2d31bcb4e7 100644 (file)
@@ -32,6 +32,7 @@
 use std::io::timer;
 use std::io;
 use std::os;
+use std::iter::repeat;
 use std::str;
 use std::string::String;
 use std::thread::Thread;
@@ -976,8 +977,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
                          proc_res: &ProcRes) {
 
     // true if we found the error in question
-    let mut found_flags = Vec::from_elem(
-        expected_errors.len(), false);
+    let mut found_flags: Vec<_> = repeat(false).take(expected_errors.len()).collect();
 
     if proc_res.status.success() {
         fatal("process did not return an error status");
@@ -1337,7 +1337,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) ->
     // Add the arguments in the run_flags directive
     args.extend(split_maybe_args(&props.run_flags).into_iter());
 
-    let prog = args.remove(0).unwrap();
+    let prog = args.remove(0);
     return ProcArgs {
         prog: prog,
         args: args,
index 21c47cdf3d752129153e6d983120417650eb3410..67058ea6a619391fe96e590471042a77d8375ac8 100644 (file)
@@ -95,7 +95,7 @@
 /// use std::thread::Thread;
 ///
 /// fn main() {
-///     let numbers = Vec::from_fn(100, |i| i as f32);
+///     let numbers: Vec<_> = range(0, 100u32).map(|i| i as f32).collect();
 ///     let shared_numbers = Arc::new(numbers);
 ///
 ///     for _ in range(0u, 10) {
index a2f38bb667447bf01bc69748fd00614eafbe7d4a..0834eacabd09e2ccfe8d2215169d808a7dc22ba0 100644 (file)
@@ -66,7 +66,7 @@
 //! // for a simpler implementation.
 //! fn shortest_path(adj_list: &Vec<Vec<Edge>>, start: uint, goal: uint) -> uint {
 //!     // dist[node] = current shortest distance from `start` to `node`
-//!     let mut dist = Vec::from_elem(adj_list.len(), uint::MAX);
+//!     let mut dist: Vec<_> = range(0, adj_list.len()).map(|_| uint::MAX).collect();
 //!
 //!     let mut heap = BinaryHeap::new();
 //!
index 430d7210bf69b105be1a6ef4032974562548213b..12faf3b5d5f253c3379abd94d8f2d41f0577e73a 100644 (file)
@@ -85,7 +85,7 @@
 use core::cmp;
 use core::default::Default;
 use core::fmt;
-use core::iter::{Cloned, Chain, Enumerate, Repeat, Skip, Take};
+use core::iter::{Cloned, Chain, Enumerate, Repeat, Skip, Take, repeat};
 use core::iter;
 use core::num::Int;
 use core::slice::{Iter, IterMut};
@@ -267,7 +267,7 @@ pub fn new() -> Bitv {
     pub fn from_elem(nbits: uint, bit: bool) -> Bitv {
         let nblocks = blocks_for_bits(nbits);
         let mut bitv = Bitv {
-            storage: Vec::from_elem(nblocks, if bit { !0u32 } else { 0u32 }),
+            storage: repeat(if bit { !0u32 } else { 0u32 }).take(nblocks).collect(),
             nbits: nbits
         };
         bitv.fix_last_block();
@@ -651,7 +651,7 @@ fn bit(bitv: &Bitv, byte: uint, bit: uint) -> u8 {
 
         let len = self.nbits/8 +
                   if self.nbits % 8 == 0 { 0 } else { 1 };
-        Vec::from_fn(len, |i|
+        range(0, len).map(|i|
             bit(self, i, 0) |
             bit(self, i, 1) |
             bit(self, i, 2) |
@@ -660,7 +660,7 @@ fn bit(bitv: &Bitv, byte: uint, bit: uint) -> u8 {
             bit(self, i, 5) |
             bit(self, i, 6) |
             bit(self, i, 7)
-        )
+        ).collect()
     }
 
     /// Deprecated: Use `iter().collect()`.
@@ -834,7 +834,7 @@ pub fn grow(&mut self, n: uint, value: bool) {
         // Allocate new words, if needed
         if new_nblocks > self.storage.len() {
             let to_add = new_nblocks - self.storage.len();
-            self.storage.grow(to_add, full_value);
+            self.storage.extend(repeat(full_value).take(to_add));
         }
 
         // Adjust internal bit count
index 2c3c546fdb7ff9c924984e491c4e625e6b17443b..9ed7cb18bc89cae51d1fecf179aca08c8bd7466d 100644 (file)
@@ -554,10 +554,10 @@ pub fn make_internal_root(left_and_out: &mut Node<K,V>, b: uint, key: K, value:
         let node = mem::replace(left_and_out, unsafe { Node::new_internal(capacity_from_b(b)) });
         left_and_out._len = 1;
         unsafe {
-            ptr::write(left_and_out.keys_mut().unsafe_mut(0), key);
-            ptr::write(left_and_out.vals_mut().unsafe_mut(0), value);
-            ptr::write(left_and_out.edges_mut().unsafe_mut(0), node);
-            ptr::write(left_and_out.edges_mut().unsafe_mut(1), right);
+            ptr::write(left_and_out.keys_mut().get_unchecked_mut(0), key);
+            ptr::write(left_and_out.vals_mut().get_unchecked_mut(0), value);
+            ptr::write(left_and_out.edges_mut().get_unchecked_mut(0), node);
+            ptr::write(left_and_out.edges_mut().get_unchecked_mut(1), right);
         }
     }
 
@@ -636,7 +636,7 @@ impl<'a, K: 'a, V: 'a> Handle<&'a Node<K, V>, handle::Edge, handle::Internal> {
     /// making it more suitable for moving down a chain of nodes.
     pub fn into_edge(self) -> &'a Node<K, V> {
         unsafe {
-            self.node.edges().unsafe_get(self.index)
+            self.node.edges().get_unchecked(self.index)
         }
     }
 }
@@ -647,7 +647,7 @@ impl<'a, K: 'a, V: 'a> Handle<&'a mut Node<K, V>, handle::Edge, handle::Internal
     /// `edge_mut`, making it more suitable for moving down a chain of nodes.
     pub fn into_edge_mut(self) -> &'a mut Node<K, V> {
         unsafe {
-            self.node.edges_mut().unsafe_mut(self.index)
+            self.node.edges_mut().get_unchecked_mut(self.index)
         }
     }
 }
@@ -721,7 +721,7 @@ impl<K, V, NodeRef: DerefMut<Node<K, V>>> Handle<NodeRef, handle::Edge, handle::
     /// confused with `node`, which references the parent node of what is returned here.
     pub fn edge_mut(&mut self) -> &mut Node<K, V> {
         unsafe {
-            self.node.edges_mut().unsafe_mut(self.index)
+            self.node.edges_mut().get_unchecked_mut(self.index)
         }
     }
 
@@ -829,8 +829,8 @@ pub fn into_kv(self) -> (&'a K, &'a V) {
         let (keys, vals) = self.node.as_slices();
         unsafe {
             (
-                keys.unsafe_get(self.index),
-                vals.unsafe_get(self.index)
+                keys.get_unchecked(self.index),
+                vals.get_unchecked(self.index)
             )
         }
     }
@@ -844,8 +844,8 @@ pub fn into_kv_mut(self) -> (&'a mut K, &'a mut V) {
         let (keys, vals) = self.node.as_slices_mut();
         unsafe {
             (
-                keys.unsafe_mut(self.index),
-                vals.unsafe_mut(self.index)
+                keys.get_unchecked_mut(self.index),
+                vals.get_unchecked_mut(self.index)
             )
         }
     }
@@ -869,14 +869,14 @@ impl<'a, K: 'a, V: 'a, NodeRef: Deref<Node<K, V>> + 'a, NodeType> Handle<NodeRef
     // /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     // /// handle.
     // pub fn key(&'a self) -> &'a K {
-    //     unsafe { self.node.keys().unsafe_get(self.index) }
+    //     unsafe { self.node.keys().get_unchecked(self.index) }
     // }
     //
     // /// Returns a reference to the value pointed-to by this handle. This doesn't return a
     // /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     // /// handle.
     // pub fn val(&'a self) -> &'a V {
-    //     unsafe { self.node.vals().unsafe_get(self.index) }
+    //     unsafe { self.node.vals().get_unchecked(self.index) }
     // }
 }
 
@@ -886,14 +886,14 @@ impl<'a, K: 'a, V: 'a, NodeRef: DerefMut<Node<K, V>> + 'a, NodeType> Handle<Node
     /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     /// handle.
     pub fn key_mut(&'a mut self) -> &'a mut K {
-        unsafe { self.node.keys_mut().unsafe_mut(self.index) }
+        unsafe { self.node.keys_mut().get_unchecked_mut(self.index) }
     }
 
     /// Returns a mutable reference to the value pointed-to by this handle. This doesn't return a
     /// reference with a lifetime as large as `into_kv_mut`, but it also does not consume the
     /// handle.
     pub fn val_mut(&'a mut self) -> &'a mut V {
-        unsafe { self.node.vals_mut().unsafe_mut(self.index) }
+        unsafe { self.node.vals_mut().get_unchecked_mut(self.index) }
     }
 }
 
@@ -1077,7 +1077,7 @@ pub fn hoist_lone_child(&mut self) {
         debug_assert!(!self.is_leaf());
 
         unsafe {
-            let ret = ptr::read(self.edges().unsafe_get(0));
+            let ret = ptr::read(self.edges().get_unchecked(0));
             self.destroy();
             ptr::write(self, ret);
         }
@@ -1091,8 +1091,8 @@ impl<K, V> Node<K, V> {
     unsafe fn push_kv(&mut self, key: K, val: V) {
         let len = self.len();
 
-        ptr::write(self.keys_mut().unsafe_mut(len), key);
-        ptr::write(self.vals_mut().unsafe_mut(len), val);
+        ptr::write(self.keys_mut().get_unchecked_mut(len), key);
+        ptr::write(self.vals_mut().get_unchecked_mut(len), val);
 
         self._len += 1;
     }
@@ -1102,7 +1102,7 @@ unsafe fn push_kv(&mut self, key: K, val: V) {
     unsafe fn push_edge(&mut self, edge: Node<K, V>) {
         let len = self.len();
 
-        ptr::write(self.edges_mut().unsafe_mut(len), edge);
+        ptr::write(self.edges_mut().get_unchecked_mut(len), edge);
     }
 
     // This must be followed by insert_edge on an internal node.
@@ -1119,12 +1119,12 @@ unsafe fn insert_kv(&mut self, index: uint, key: K, val: V) -> &mut V {
             self.len() - index
         );
 
-        ptr::write(self.keys_mut().unsafe_mut(index), key);
-        ptr::write(self.vals_mut().unsafe_mut(index), val);
+        ptr::write(self.keys_mut().get_unchecked_mut(index), key);
+        ptr::write(self.vals_mut().get_unchecked_mut(index), val);
 
         self._len += 1;
 
-        self.vals_mut().unsafe_mut(index)
+        self.vals_mut().get_unchecked_mut(index)
     }
 
     // This can only be called immediately after a call to insert_kv.
@@ -1135,14 +1135,14 @@ unsafe fn insert_edge(&mut self, index: uint, edge: Node<K, V>) {
             self.edges().as_ptr().offset(index as int),
             self.len() - index
         );
-        ptr::write(self.edges_mut().unsafe_mut(index), edge);
+        ptr::write(self.edges_mut().get_unchecked_mut(index), edge);
     }
 
     // This must be followed by pop_edge on an internal node.
     #[inline]
     unsafe fn pop_kv(&mut self) -> (K, V) {
-        let key = ptr::read(self.keys().unsafe_get(self.len() - 1));
-        let val = ptr::read(self.vals().unsafe_get(self.len() - 1));
+        let key = ptr::read(self.keys().get_unchecked(self.len() - 1));
+        let val = ptr::read(self.vals().get_unchecked(self.len() - 1));
 
         self._len -= 1;
 
@@ -1152,7 +1152,7 @@ unsafe fn pop_kv(&mut self) -> (K, V) {
     // This can only be called immediately after a call to pop_kv.
     #[inline]
     unsafe fn pop_edge(&mut self) -> Node<K, V> {
-        let edge = ptr::read(self.edges().unsafe_get(self.len() + 1));
+        let edge = ptr::read(self.edges().get_unchecked(self.len() + 1));
 
         edge
     }
@@ -1160,8 +1160,8 @@ unsafe fn pop_edge(&mut self) -> Node<K, V> {
     // This must be followed by remove_edge on an internal node.
     #[inline]
     unsafe fn remove_kv(&mut self, index: uint) -> (K, V) {
-        let key = ptr::read(self.keys().unsafe_get(index));
-        let val = ptr::read(self.vals().unsafe_get(index));
+        let key = ptr::read(self.keys().get_unchecked(index));
+        let val = ptr::read(self.vals().get_unchecked(index));
 
         ptr::copy_memory(
             self.keys_mut().as_mut_ptr().offset(index as int),
@@ -1182,7 +1182,7 @@ unsafe fn remove_kv(&mut self, index: uint) -> (K, V) {
     // This can only be called immediately after a call to remove_kv.
     #[inline]
     unsafe fn remove_edge(&mut self, index: uint) -> Node<K, V> {
-        let edge = ptr::read(self.edges().unsafe_get(index));
+        let edge = ptr::read(self.edges().get_unchecked(index));
 
         ptr::copy_memory(
             self.edges_mut().as_mut_ptr().offset(index as int),
@@ -1229,8 +1229,8 @@ fn split(&mut self) -> (K, V, Node<K, V>) {
                 );
             }
 
-            let key = ptr::read(self.keys().unsafe_get(right_offset - 1));
-            let val = ptr::read(self.vals().unsafe_get(right_offset - 1));
+            let key = ptr::read(self.keys().get_unchecked(right_offset - 1));
+            let val = ptr::read(self.vals().get_unchecked(right_offset - 1));
 
             self._len = right_offset - 1;
 
@@ -1249,8 +1249,8 @@ fn absorb(&mut self, key: K, val: V, mut right: Node<K, V>) {
             let old_len = self.len();
             self._len += right.len() + 1;
 
-            ptr::write(self.keys_mut().unsafe_mut(old_len), key);
-            ptr::write(self.vals_mut().unsafe_mut(old_len), val);
+            ptr::write(self.keys_mut().get_unchecked_mut(old_len), key);
+            ptr::write(self.vals_mut().get_unchecked_mut(old_len), val);
 
             ptr::copy_nonoverlapping_memory(
                 self.keys_mut().as_mut_ptr().offset(old_len as int + 1),
index d8ce79f4fe90d29c3e9f28e80cf46848cf7f3a94..4eaaad07c994f48a14a322bb5c248840526d0b02 100644 (file)
@@ -1290,8 +1290,10 @@ fn fuzz_test(sz: int) {
                     v.pop();
                 }
                 1 => {
-                    m.pop_front();
-                    v.remove(0);
+                    if !v.is_empty() {
+                        m.pop_front();
+                        v.remove(0);
+                    }
                 }
                 2 | 4 =>  {
                     m.push_front(-i);
index fe9d8de440a17aca42c15bad4f6d11fc071b031b..688214140c1be1ec999bd24dc1b9ca3d6a0e8e50 100644 (file)
@@ -128,8 +128,8 @@ mod prelude {
     pub use unicode::char::UnicodeChar;
 
     // from collections.
-    pub use slice::{CloneSliceExt, VectorVector};
-    pub use str::{IntoMaybeOwned, StrVector};
+    pub use slice::{CloneSliceExt, SliceConcatExt};
+    pub use str::IntoMaybeOwned;
     pub use string::{String, ToString};
     pub use vec::Vec;
 }
index df8e08f07a32150f4390a8fb914a01dd029629b3..82b24e627d99b82d472e4c46da9ace6788a287cf 100644 (file)
@@ -1137,7 +1137,7 @@ fn next(&mut self) -> Option<&'a T> {
         }
         let tail = self.tail;
         self.tail = wrap_index(self.tail + 1, self.ring.len());
-        unsafe { Some(self.ring.unsafe_get(tail)) }
+        unsafe { Some(self.ring.get_unchecked(tail)) }
     }
 
     #[inline]
@@ -1154,7 +1154,7 @@ fn next_back(&mut self) -> Option<&'a T> {
             return None;
         }
         self.head = wrap_index(self.head - 1, self.ring.len());
-        unsafe { Some(self.ring.unsafe_get(self.head)) }
+        unsafe { Some(self.ring.get_unchecked(self.head)) }
     }
 }
 
@@ -1173,7 +1173,7 @@ fn idx(&mut self, j: uint) -> Option<&'a T> {
             None
         } else {
             let idx = wrap_index(self.tail + j, self.ring.len());
-            unsafe { Some(self.ring.unsafe_get(idx)) }
+            unsafe { Some(self.ring.get_unchecked(idx)) }
         }
     }
 }
index 375ba38f29aabd7e8b3a063f61b572b07bfb99a2..385380bb7978e480499bb71590ea0172e1703cf1 100644 (file)
 use core::mem;
 use core::ops::{FnMut,SliceMut};
 use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
-use core::prelude::{Ord, Ordering, RawPtr, Some, range, IteratorCloneExt, Result};
+use core::prelude::{Ord, Ordering, PtrExt, Some, range, IteratorCloneExt, Result};
 use core::ptr;
 use core::slice as core_slice;
 use self::Direction::*;
 
 use vec::Vec;
 
-pub use core::slice::{Chunks, AsSlice, SplitN, Windows};
+pub use core::slice::{Chunks, AsSlice, Windows};
 pub use core::slice::{Iter, IterMut, PartialEqSliceExt};
 pub use core::slice::{IntSliceExt, SplitMut, ChunksMut, Split};
 pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
 pub use core::slice::{bytes, mut_ref_slice, ref_slice};
 pub use core::slice::{from_raw_buf, from_raw_mut_buf};
 
+#[deprecated = "use Iter instead"]
+pub type Items<'a, T:'a> = Iter<'a, T>;
+
+#[deprecated = "use IterMut instead"]
+pub type MutItems<'a, T:'a> = IterMut<'a, T>;
+
 ////////////////////////////////////////////////////////////////////////////////
 // Basic slice extension methods
 ////////////////////////////////////////////////////////////////////////////////
@@ -1412,7 +1418,7 @@ mod tests {
     use prelude::{Some, None, range, Vec, ToString, Clone, Greater, Less, Equal};
     use prelude::{SliceExt, Iterator, IteratorExt, DoubleEndedIteratorExt};
     use prelude::{OrdSliceExt, CloneSliceExt, PartialEqSliceExt, AsSlice};
-    use prelude::{RandomAccessIterator, Ord, VectorVector};
+    use prelude::{RandomAccessIterator, Ord, SliceConcatExt};
     use core::cell::Cell;
     use core::default::Default;
     use core::mem;
@@ -1678,15 +1684,19 @@ fn test_pop() {
     fn test_swap_remove() {
         let mut v = vec![1i, 2, 3, 4, 5];
         let mut e = v.swap_remove(0);
-        assert_eq!(e, Some(1));
+        assert_eq!(e, 1);
         assert_eq!(v, vec![5i, 2, 3, 4]);
         e = v.swap_remove(3);
-        assert_eq!(e, Some(4));
+        assert_eq!(e, 4);
         assert_eq!(v, vec![5i, 2, 3]);
+    }
 
-        e = v.swap_remove(3);
-        assert_eq!(e, None);
-        assert_eq!(v, vec![5i, 2, 3]);
+    #[test]
+    #[should_fail]
+    fn test_swap_remove_fail() {
+        let mut v = vec![1i];
+        let _ = v.swap_remove(0);
+        let _ = v.swap_remove(0);
     }
 
     #[test]
@@ -1970,48 +1980,48 @@ fn test_position_elem() {
     }
 
     #[test]
-    fn test_binary_search_elem() {
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&5).found(), Some(4));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&4).found(), Some(3));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&3).found(), Some(2));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&2).found(), Some(1));
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&1).found(), Some(0));
+    fn test_binary_search() {
+        assert_eq!([1i,2,3,4,5].binary_search(&5).ok(), Some(4));
+        assert_eq!([1i,2,3,4,5].binary_search(&4).ok(), Some(3));
+        assert_eq!([1i,2,3,4,5].binary_search(&3).ok(), Some(2));
+        assert_eq!([1i,2,3,4,5].binary_search(&2).ok(), Some(1));
+        assert_eq!([1i,2,3,4,5].binary_search(&1).ok(), Some(0));
 
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6,8,10].binary_search_elem(&10).found(), Some(4));
+        assert_eq!([2i,4,6,8,10].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6,8,10].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6,8,10].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6,8,10].binary_search(&10).ok(), Some(4));
 
-        assert_eq!([2i,4,6,8].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6,8].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6,8].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6,8].binary_search_elem(&8).found(), Some(3));
+        assert_eq!([2i,4,6,8].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6,8].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6,8].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6,8].binary_search(&8).ok(), Some(3));
 
-        assert_eq!([2i,4,6].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4,6].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4,6].binary_search_elem(&4).found(), Some(1));
-        assert_eq!([2i,4,6].binary_search_elem(&6).found(), Some(2));
+        assert_eq!([2i,4,6].binary_search(&1).ok(), None);
+        assert_eq!([2i,4,6].binary_search(&5).ok(), None);
+        assert_eq!([2i,4,6].binary_search(&4).ok(), Some(1));
+        assert_eq!([2i,4,6].binary_search(&6).ok(), Some(2));
 
-        assert_eq!([2i,4].binary_search_elem(&1).found(), None);
-        assert_eq!([2i,4].binary_search_elem(&5).found(), None);
-        assert_eq!([2i,4].binary_search_elem(&2).found(), Some(0));
-        assert_eq!([2i,4].binary_search_elem(&4).found(), Some(1));
+        assert_eq!([2i,4].binary_search(&1).ok(), None);
+        assert_eq!([2i,4].binary_search(&5).ok(), None);
+        assert_eq!([2i,4].binary_search(&2).ok(), Some(0));
+        assert_eq!([2i,4].binary_search(&4).ok(), Some(1));
 
-        assert_eq!([2i].binary_search_elem(&1).found(), None);
-        assert_eq!([2i].binary_search_elem(&5).found(), None);
-        assert_eq!([2i].binary_search_elem(&2).found(), Some(0));
+        assert_eq!([2i].binary_search(&1).ok(), None);
+        assert_eq!([2i].binary_search(&5).ok(), None);
+        assert_eq!([2i].binary_search(&2).ok(), Some(0));
 
-        assert_eq!([].binary_search_elem(&1i).found(), None);
-        assert_eq!([].binary_search_elem(&5i).found(), None);
+        assert_eq!([].binary_search(&1i).ok(), None);
+        assert_eq!([].binary_search(&5i).ok(), None);
 
-        assert!([1i,1,1,1,1].binary_search_elem(&1).found() != None);
-        assert!([1i,1,1,1,2].binary_search_elem(&1).found() != None);
-        assert!([1i,1,1,2,2].binary_search_elem(&1).found() != None);
-        assert!([1i,1,2,2,2].binary_search_elem(&1).found() != None);
-        assert_eq!([1i,2,2,2,2].binary_search_elem(&1).found(), Some(0));
+        assert!([1i,1,1,1,1].binary_search(&1).ok() != None);
+        assert!([1i,1,1,1,2].binary_search(&1).ok() != None);
+        assert!([1i,1,1,2,2].binary_search(&1).ok() != None);
+        assert!([1i,1,2,2,2].binary_search(&1).ok() != None);
+        assert_eq!([1i,2,2,2,2].binary_search(&1).ok(), Some(0));
 
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&6).found(), None);
-        assert_eq!([1i,2,3,4,5].binary_search_elem(&0).found(), None);
+        assert_eq!([1i,2,3,4,5].binary_search(&6).ok(), None);
+        assert_eq!([1i,2,3,4,5].binary_search(&0).ok(), None);
     }
 
     #[test]
@@ -2106,13 +2116,15 @@ fn test_partitioned() {
     #[test]
     fn test_concat() {
         let v: [Vec<int>, ..0] = [];
-        assert_eq!(v.concat_vec(), vec![]);
-        assert_eq!([vec![1i], vec![2i,3i]].concat_vec(), vec![1, 2, 3]);
+        let c: Vec<int> = v.concat();
+        assert_eq!(c, []);
+        let d: Vec<int> = [vec![1i], vec![2i,3i]].concat();
+        assert_eq!(d, vec![1i, 2, 3]);
 
         let v: [&[int], ..2] = [&[1], &[2, 3]];
-        assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 3]);
-        let v: [&[int], ..3] = [&[1], &[2], &[3]];
-        assert_eq!(v.connect_vec(&0), vec![1, 0, 2, 0, 3]);
+        assert_eq!(v.connect(&0), vec![1i, 0, 2, 3]);
+        let v: [&[int], ..3] = [&[1i], &[2], &[3]];
+        assert_eq!(v.connect(&0), vec![1i, 0, 2, 0, 3]);
     }
 
     #[test]
@@ -2158,23 +2170,25 @@ fn test_insert_oob() {
     fn test_remove() {
         let mut a = vec![1i,2,3,4];
 
-        assert_eq!(a.remove(2), Some(3));
+        assert_eq!(a.remove(2), 3);
         assert_eq!(a, vec![1i,2,4]);
 
-        assert_eq!(a.remove(2), Some(4));
-        assert_eq!(a, vec![1i,2]);
-
-        assert_eq!(a.remove(2), None);
+        assert_eq!(a.remove(2), 4);
         assert_eq!(a, vec![1i,2]);
 
-        assert_eq!(a.remove(0), Some(1));
+        assert_eq!(a.remove(0), 1);
         assert_eq!(a, vec![2i]);
 
-        assert_eq!(a.remove(0), Some(2));
+        assert_eq!(a.remove(0), 2);
         assert_eq!(a, vec![]);
+    }
 
-        assert_eq!(a.remove(0), None);
-        assert_eq!(a.remove(10), None);
+    #[test]
+    #[should_fail]
+    fn test_remove_fail() {
+        let mut a = vec![1i];
+        let _ = a.remove(0);
+        let _ = a.remove(0);
     }
 
     #[test]
@@ -2870,7 +2884,7 @@ fn concat(b: &mut Bencher) {
         let xss: Vec<Vec<uint>> =
             Vec::from_fn(100, |i| range(0u, i).collect());
         b.iter(|| {
-            xss.as_slice().concat_vec()
+            xss.as_slice().concat();
         });
     }
 
index 60449c817cbd388ad901841201c2c99a593aad6f..8d5d76f9598f4a400b0a482399222cf78539b8e2 100644 (file)
 
 impl<S: Str> SliceConcatExt<str, String> for [S] {
     fn concat(&self) -> String {
-        if self.is_empty() {
+        let s = self.as_slice();
+
+        if s.is_empty() {
             return String::new();
         }
 
         // `len` calculation may overflow but push_str will check boundaries
-        let len = self.iter().map(|s| s.as_slice().len()).sum();
-
+        let len = s.iter().map(|s| s.as_slice().len()).sum();
         let mut result = String::with_capacity(len);
 
-        for s in self.iter() {
-            result.push_str(s.as_slice());
+        for s in s.iter() {
+            result.push_str(s.as_slice())
         }
 
         result
     }
 
     fn connect(&self, sep: &str) -> String {
-        if self.is_empty() {
+        let s = self.as_slice();
+
+        if s.is_empty() {
             return String::new();
         }
 
         // concat is faster
         if sep.is_empty() {
-            return self.concat();
+            return s.concat();
         }
 
         // this is wrong without the guarantee that `self` is non-empty
         // `len` calculation may overflow but push_str but will check boundaries
-        let len = sep.len() * (self.len() - 1)
-            + self.iter().map(|s| s.as_slice().len()).sum();
+        let len = sep.len() * (s.len() - 1)
+            + s.iter().map(|s| s.as_slice().len()).sum();
         let mut result = String::with_capacity(len);
         let mut first = true;
 
-        for s in self.iter() {
+        for s in s.iter() {
             if first {
                 first = false;
             } else {
@@ -141,11 +144,6 @@ fn connect(&self, sep: &str) -> String {
     }
 }
 
-impl<S: Str> SliceConcatExt<str, String> for Vec<S> {
-    fn concat(&self) -> String { self[].concat() }
-    fn connect(&self, sep: &str) -> String { self[].connect(sep) }
-}
-
 /*
 Section: Iterators
 */
@@ -186,7 +184,7 @@ pub struct Decompositions<'a> {
 impl<'a> Iterator<char> for Decompositions<'a> {
     #[inline]
     fn next(&mut self) -> Option<char> {
-        match self.buffer.head() {
+        match self.buffer.first() {
             Some(&(c, 0)) => {
                 self.sorted = false;
                 self.buffer.remove(0);
@@ -233,13 +231,16 @@ fn next(&mut self) -> Option<char> {
             self.sorted = true;
         }
 
-        match self.buffer.remove(0) {
-            Some((c, 0)) => {
-                self.sorted = false;
-                Some(c)
+        if self.buffer.is_empty() {
+            None
+        } else {
+            match self.buffer.remove(0) {
+                (c, 0) => {
+                    self.sorted = false;
+                    Some(c)
+                }
+                (c, _) => Some(c),
             }
-            Some((c, _)) => Some(c),
-            None => None
         }
     }
 
@@ -712,7 +713,7 @@ fn lev_distance(&self, t: &str) -> uint {
         if me.is_empty() { return t.chars().count(); }
         if t.is_empty() { return me.chars().count(); }
 
-        let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
+        let mut dcol: Vec<_> = range(0, t.len() + 1).collect();
         let mut t_last = 0;
 
         for (i, sc) in me.chars().enumerate() {
@@ -1857,22 +1858,12 @@ fn t(a: &str, b: &str, start: uint) {
         assert_eq!("ะเทศไท", "ประเทศไทย中华Việt Nam".slice_chars(2, 8));
     }
 
-    struct S {
-        x: [String, .. 2]
-    }
-
-    impl AsSlice<String> for S {
-        fn as_slice<'a> (&'a self) -> &'a [String] {
-            &self.x
-        }
-    }
-
     fn s(x: &str) -> String { x.into_string() }
 
     macro_rules! test_concat {
         ($expected: expr, $string: expr) => {
             {
-                let s = $string.concat();
+                let s: String = $string.concat();
                 assert_eq!($expected, s);
             }
         }
@@ -1880,22 +1871,10 @@ macro_rules! test_concat {
 
     #[test]
     fn test_concat_for_different_types() {
-        test_concat!("ab", ["a", "b"]);
-        test_concat!("ab", [s("a"), s("b")]);
+        test_concat!("ab", vec![s("a"), s("b")]);
         test_concat!("ab", vec!["a", "b"]);
         test_concat!("ab", vec!["a", "b"].as_slice());
         test_concat!("ab", vec![s("a"), s("b")]);
-
-        let mut v0 = ["a", "b"];
-        let mut v1 = [s("a"), s("b")];
-        unsafe {
-            use std::c_vec::CVec;
-
-            test_concat!("ab", CVec::new(v0.as_mut_ptr(), v0.len()));
-            test_concat!("ab", CVec::new(v1.as_mut_ptr(), v1.len()));
-        }
-
-        test_concat!("ab", S { x: [s("a"), s("b")] });
     }
 
     #[test]
@@ -1924,17 +1903,6 @@ fn test_connect_for_different_types() {
         test_connect!("a-b", vec!["a", "b"], hyphen.as_slice());
         test_connect!("a-b", vec!["a", "b"].as_slice(), "-");
         test_connect!("a-b", vec![s("a"), s("b")], "-");
-
-        let mut v0 = ["a", "b"];
-        let mut v1 = [s("a"), s("b")];
-        unsafe {
-            use std::c_vec::CVec;
-
-            test_connect!("a-b", CVec::new(v0.as_mut_ptr(), v0.len()), "-");
-            test_connect!("a-b", CVec::new(v1.as_mut_ptr(), v1.len()), hyphen.as_slice());
-        }
-
-        test_connect!("a-b", S { x: [s("a"), s("b")] }, "-");
     }
 
     #[test]
@@ -3304,7 +3272,7 @@ fn test_into_maybe_owned() {
 #[cfg(test)]
 mod bench {
     use super::*;
-    use prelude::{SliceExt, IteratorExt, DoubleEndedIteratorExt};
+    use prelude::{SliceExt, IteratorExt, DoubleEndedIteratorExt, SliceConcatExt};
     use test::Bencher;
     use test::black_box;
 
@@ -3467,7 +3435,7 @@ fn is_utf8_100_multibyte(b: &mut Bencher) {
     fn bench_connect(b: &mut Bencher) {
         let s = "ศไทย中华Việt Nam; Mary had a little lamb, Little lamb";
         let sep = "→";
-        let v = [s, s, s, s, s, s, s, s, s, s];
+        let v = vec![s, s, s, s, s, s, s, s, s, s];
         b.iter(|| {
             assert_eq!(v.connect(sep).len(), s.len() * 10 + sep.len() * 9);
         })
index c6c19cae75f1efc1b55a005d0f6a8eeb6cf307d6..433384b625f4045f5486fac6beaf15d7c07d99b8 100644 (file)
@@ -151,7 +151,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> CowString<'a> {
         let mut i = 0;
         let total = v.len();
         fn unsafe_get(xs: &[u8], i: uint) -> u8 {
-            unsafe { *xs.unsafe_get(i) }
+            unsafe { *xs.get_unchecked(i) }
         }
         fn safe_get(xs: &[u8], i: uint, total: uint) -> u8 {
             if i >= total {
index 2d71705d80d387b0261d0c579fdff1a4505b75f2..a694242d1ccaf62a5b2f8d7c9fca0b7c41762f9e 100644 (file)
@@ -173,8 +173,7 @@ pub fn new() -> Vec<T> {
     ///
     /// It is important to note that this function does not specify the *length* of the returned
     /// vector, but only the *capacity*. (For an explanation of the difference between length and
-    /// capacity, see the main `Vec<T>` docs above, 'Capacity and reallocation'.) To create a
-    /// vector of a given length, use `Vec::from_elem` or `Vec::from_fn`.
+    /// capacity, see the main `Vec<T>` docs above, 'Capacity and reallocation'.)
     ///
     /// # Examples
     ///
@@ -272,7 +271,7 @@ pub unsafe fn from_raw_buf(ptr: *const T, elts: uint) -> Vec<T> {
     /// Deprecated: use `into_iter().partition(f)` instead.
     #[inline]
     #[deprecated = "use into_iter().partition(f) instead"]
-    pub fn partition<F>(self, mut f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
+    pub fn partition<F>(self, f: F) -> (Vec<T>, Vec<T>) where F: FnMut(&T) -> bool {
         self.into_iter().partition(f)
     }
 
@@ -298,7 +297,7 @@ pub fn reserve_additional(&mut self, extra: uint) {
     }
 
     /// Reserves capacity for at least `additional` more elements to be inserted in the given
-    /// `Vec`. The collection may reserve more space to avoid frequent reallocations.
+    /// `Vec<T>`. The collection may reserve more space to avoid frequent reallocations.
     ///
     /// # Panics
     ///
@@ -322,7 +321,7 @@ pub fn reserve(&mut self, additional: uint) {
     }
 
     /// Reserves the minimum capacity for exactly `additional` more elements to
-    /// be inserted in the given `Vec`. Does nothing if the capacity is already
+    /// be inserted in the given `Vec<T>`. Does nothing if the capacity is already
     /// sufficient.
     ///
     /// Note that the allocator may give the collection more space than it
@@ -350,9 +349,10 @@ pub fn reserve_exact(&mut self, additional: uint) {
         }
     }
 
-    /// Shrinks the capacity of the vector as much as possible. It will drop
-    /// down as close as possible to the length but the allocator may still
-    /// inform the vector that there is space for a few more elements.
+    /// Shrinks the capacity of the vector as much as possible.
+    ///
+    /// It will drop down as close as possible to the length but the allocator
+    /// may still inform the vector that there is space for a few more elements.
     ///
     /// # Examples
     ///
@@ -370,7 +370,7 @@ pub fn shrink_to_fit(&mut self) {
         if self.len == 0 {
             if self.cap != 0 {
                 unsafe {
-                    dealloc(self.ptr, self.cap)
+                    dealloc(*self.ptr, self.cap)
                 }
                 self.cap = 0;
             }
@@ -378,11 +378,12 @@ pub fn shrink_to_fit(&mut self) {
             unsafe {
                 // Overflow check is unnecessary as the vector is already at
                 // least this large.
-                self.ptr = reallocate(self.ptr as *mut u8,
-                                      self.cap * mem::size_of::<T>(),
-                                      self.len * mem::size_of::<T>(),
-                                      mem::min_align_of::<T>()) as *mut T;
-                if self.ptr.is_null() { ::alloc::oom() }
+                let ptr = reallocate(*self.ptr as *mut u8,
+                                     self.cap * mem::size_of::<T>(),
+                                     self.len * mem::size_of::<T>(),
+                                     mem::min_align_of::<T>()) as *mut T;
+                if ptr.is_null() { ::alloc::oom() }
+                self.ptr = NonZero::new(ptr);
             }
             self.cap = self.len;
         }
@@ -443,15 +444,15 @@ pub fn truncate(&mut self, len: uint) {
     pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
         unsafe {
             mem::transmute(RawSlice {
-                data: self.ptr as *const T,
+                data: *self.ptr as *const T,
                 len: self.len,
             })
         }
     }
 
-    /// Creates a consuming iterator, that is, one that moves each
-    /// value out of the vector (from start to end). The vector cannot
-    /// be used after calling this.
+    /// Creates a consuming iterator, that is, one that moves each value out of
+    /// the vector (from start to end). The vector cannot be used after calling
+    /// this.
     ///
     /// # Examples
     ///
@@ -466,9 +467,9 @@ pub fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
     #[stable]
     pub fn into_iter(self) -> IntoIter<T> {
         unsafe {
-            let ptr = self.ptr;
+            let ptr = *self.ptr;
             let cap = self.cap;
-            let begin = self.ptr as *const T;
+            let begin = ptr as *const T;
             let end = if mem::size_of::<T>() == 0 {
                 (ptr as uint + self.len()) as *const T
             } else {
@@ -512,13 +513,11 @@ pub unsafe fn set_len(&mut self, len: uint) {
     /// ```
     /// let mut v = vec!["foo", "bar", "baz", "qux"];
     ///
-    /// assert_eq!(v.swap_remove(1), Some("bar"));
+    /// assert_eq!(v.swap_remove(1), "bar");
     /// assert_eq!(v, vec!["foo", "qux", "baz"]);
     ///
-    /// assert_eq!(v.swap_remove(0), Some("foo"));
+    /// assert_eq!(v.swap_remove(0), "foo");
     /// assert_eq!(v, vec!["baz", "qux"]);
-    ///
-    /// assert_eq!(v.swap_remove(2), None);
     /// ```
     #[inline]
     #[stable]
@@ -577,11 +576,7 @@ pub fn insert(&mut self, index: uint, element: T) {
     ///
     /// ```
     /// let mut v = vec![1i, 2, 3];
-    /// assert_eq!(v.remove(1), Some(2));
-    /// assert_eq!(v, vec![1, 3]);
-    ///
-    /// assert_eq!(v.remove(4), None);
-    /// // v is unchanged:
+    /// assert_eq!(v.remove(1), 2);
     /// assert_eq!(v, vec![1, 3]);
     /// ```
     #[stable]
@@ -1185,8 +1180,9 @@ fn grow_capacity(&mut self, capacity: uint) {
             let size = capacity.checked_mul(mem::size_of::<T>())
                                .expect("capacity overflow");
             unsafe {
-                self.ptr = alloc_or_realloc(self.ptr, self.cap * mem::size_of::<T>(), size);
-                if self.ptr.is_null() { ::alloc::oom() }
+                let ptr = alloc_or_realloc(*self.ptr, self.cap * mem::size_of::<T>(), size);
+                if ptr.is_null() { ::alloc::oom() }
+                self.ptr = NonZero::new(ptr);
             }
             self.cap = capacity;
         }
@@ -2207,9 +2203,10 @@ fn test_slice_out_of_bounds_5() {
     }
 
     #[test]
+    #[should_fail]
     fn test_swap_remove_empty() {
         let mut vec: Vec<uint> = vec!();
-        assert_eq!(vec.swap_remove(0), None);
+        vec.swap_remove(0);
     }
 
     #[test]
index 5ebcc736624f6f95a7a6c3c158a5dfbb8a28e845..42d4a28405c8b9028b0a542a8bdf990182a82b34 100644 (file)
@@ -448,7 +448,7 @@ pub fn swap(&mut self, key: uint, value: V) -> Option<V> {
     pub fn insert(&mut self, key: uint, value: V) -> Option<V> {
         let len = self.v.len();
         if len <= key {
-            self.v.grow_fn(key - len + 1, |_| None);
+            self.v.extend(range(0, key - len + 1).map(|_| None));
         }
         replace(&mut self.v[key], Some(value))
     }
index a185ec56a00e7e9750960c3238f3b2e172235fa6..b0fd52896fe5726b078dba2e63b0162e454fa348 100644 (file)
@@ -478,7 +478,7 @@ fn collect<B: FromIterator<A>>(self) -> B {
     ///
     /// ```
     /// let vec = vec![1i, 2i, 3i, 4i];
-    /// let (even, odd): (Vec<int>, Vec<Int>) = vec.into_iter().partition(|&n| n % 2 == 0);
+    /// let (even, odd): (Vec<int>, Vec<int>) = vec.into_iter().partition(|&n| n % 2 == 0);
     /// assert_eq!(even, vec![2, 4]);
     /// assert_eq!(odd, vec![1, 3]);
     /// ```
index 38d8977c0aa840730b4c1456a9bd07ff00c3a810..1bf05247a671cb227e27552206da3edeb3c0264a 100644 (file)
@@ -46,6 +46,8 @@
 use ops::{FnMut, mod};
 use option::Option;
 use option::Option::{None, Some};
+use result::Result;
+use result::Result::{Ok, Err};
 use ptr;
 use ptr::PtrExt;
 use mem;
@@ -237,7 +239,7 @@ fn as_ptr(&self) -> *const T {
     }
 
     #[unstable]
-    fn binary_search_by<F>(&self, mut f: F) -> Result where
+    fn binary_search_by<F>(&self, mut f: F) -> Result<uint, uint> where
         F: FnMut(&T) -> Ordering
     {
         let mut base : uint = 0;
@@ -255,7 +257,7 @@ fn binary_search_by<F>(&self, mut f: F) -> Result where
             }
             lim >>= 1;
         }
-        Err(base);
+        Err(base)
     }
 
     #[inline]
index 987da903211170bac275d898a2da6b6d4223a878..9ef7d6030593a008f24a6d22fb1477afcdcd5ead 100644 (file)
@@ -8,30 +8,30 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::slice::BinarySearchResult::{Found, NotFound};
+use core::result::Result::{Ok, Err};
 
 #[test]
 fn binary_search_not_found() {
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&6)) == Found(3));
+    assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3));
+    assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&6)) == Found(3));
+    assert!(b.binary_search_by(|v| v.cmp(&6)) == Ok(3));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&5)) == NotFound(3));
+    assert!(b.binary_search_by(|v| v.cmp(&5)) == Err(3));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&8)) == Found(4));
+    assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(4));
     let b = [1i, 2, 4, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(4));
+    assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(4));
     let b = [1i, 2, 4, 6, 7, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&8)) == Found(5));
+    assert!(b.binary_search_by(|v| v.cmp(&8)) == Ok(5));
     let b = [1i, 2, 4, 5, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&7)) == NotFound(5));
+    assert!(b.binary_search_by(|v| v.cmp(&7)) == Err(5));
     let b = [1i, 2, 4, 5, 6, 8, 9];
-    assert!(b.binary_search(|v| v.cmp(&0)) == NotFound(0));
+    assert!(b.binary_search_by(|v| v.cmp(&0)) == Err(0));
     let b = [1i, 2, 4, 5, 6, 8];
-    assert!(b.binary_search(|v| v.cmp(&9)) == NotFound(6));
+    assert!(b.binary_search_by(|v| v.cmp(&9)) == Err(6));
 }
 
 #[test]
index 0426f269376216340c144e3b255bca04b35ae11a..0184222b9e0b660fea87cf2d43eaae35818d03d0 100644 (file)
@@ -578,7 +578,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result {
 
     fn f(_x: uint) -> Vec<Optval> { return Vec::new(); }
 
-    let mut vals = Vec::from_fn(n_opts, f);
+    let mut vals: Vec<_> = range(0, n_opts).map(f).collect();
     let mut free: Vec<String> = Vec::new();
     let l = args.len();
     let mut i = 0;
index 3cb1f51a6a80102d472271934b1d7780983c14bd..a76e5ebd08a8493ae4ff217f9863193350515e16 100644 (file)
@@ -361,7 +361,7 @@ fn isaac64(&mut self) {
         const MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
         macro_rules! ind (
             ($x:expr) => {
-                *self.mem.unsafe_get(($x as uint >> 3) & (RAND_SIZE_64 - 1))
+                *self.mem.get_unchecked(($x as uint >> 3) & (RAND_SIZE_64 - 1))
             }
         );
 
@@ -375,13 +375,13 @@ macro_rules! rngstepp(
                             let mix = if $j == 0 {!mix} else {mix};
 
                             unsafe {
-                                let x = *self.mem.unsafe_get(base + mr_offset);
-                                a = mix + *self.mem.unsafe_get(base + m2_offset);
+                                let x = *self.mem.get_unchecked(base + mr_offset);
+                                a = mix + *self.mem.get_unchecked(base + m2_offset);
                                 let y = ind!(x) + a + b;
-                                *self.mem.unsafe_mut(base + mr_offset) = y;
+                                *self.mem.get_unchecked_mut(base + mr_offset) = y;
 
                                 b = ind!(y >> RAND_SIZE_64_LEN) + x;
-                                *self.rsl.unsafe_mut(base + mr_offset) = b;
+                                *self.rsl.get_unchecked_mut(base + mr_offset) = b;
                             }
                         }}
                     );
@@ -392,13 +392,13 @@ macro_rules! rngstepn(
                             let mix = if $j == 0 {!mix} else {mix};
 
                             unsafe {
-                                let x = *self.mem.unsafe_get(base + mr_offset);
-                                a = mix + *self.mem.unsafe_get(base + m2_offset);
+                                let x = *self.mem.get_unchecked(base + mr_offset);
+                                a = mix + *self.mem.get_unchecked(base + m2_offset);
                                 let y = ind!(x) + a + b;
-                                *self.mem.unsafe_mut(base + mr_offset) = y;
+                                *self.mem.get_unchecked_mut(base + mr_offset) = y;
 
                                 b = ind!(y >> RAND_SIZE_64_LEN) + x;
-                                *self.rsl.unsafe_mut(base + mr_offset) = b;
+                                *self.rsl.get_unchecked_mut(base + mr_offset) = b;
                             }
                         }}
                     );
index cbe69295050ec02953a3ee0a9cc841819b780928..fd0c54e8ed3a8fce98cb8b2a7d525463a005b167 100644 (file)
@@ -11,6 +11,7 @@
 use std::io::{IoError, IoResult, SeekStyle};
 use std::io;
 use std::slice;
+use std::iter::repeat;
 
 static BUF_CAPACITY: uint = 128;
 
@@ -87,7 +88,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
             // currently are
             let difference = self.pos as i64 - self.buf.len() as i64;
             if difference > 0 {
-                self.buf.grow(difference as uint, 0);
+                self.buf.extend(repeat(0).take(difference as uint));
             }
 
             // Figure out what bytes will be used to overwrite what's currently
index c361a25bf52eb6c9af82b72e8fa013b0662d6421..1476e6ab8a7068669c5e8b81edc13cb0e1bb2660 100644 (file)
@@ -14,6 +14,7 @@
 pub use self::Inst::*;
 
 use std::cmp;
+use std::iter::repeat;
 use parse;
 use parse::{
     Flags, FLAG_EMPTY,
@@ -157,7 +158,7 @@ fn compile(&mut self, ast: parse::Ast) {
             Capture(cap, name, x) => {
                 let len = self.names.len();
                 if cap >= len {
-                    self.names.grow(10 + cap - len, None)
+                    self.names.extend(repeat(None).take(10 + cap - len))
                 }
                 self.names[cap] = name;
 
index 86c02de76dcc6b146839d378ee3473d264c9e814..692a065299ca2b25a21d39c6f515a760c7fc87b9 100644 (file)
@@ -18,7 +18,6 @@
 use std::fmt;
 use std::iter;
 use std::num;
-use std::slice::BinarySearchResult;
 
 /// Static data containing Unicode ranges for general categories and scripts.
 use unicode::regex::{UNICODE_CLASSES, PERLD, PERLS, PERLW};
@@ -1028,9 +1027,9 @@ fn is_valid_cap(c: char) -> bool {
 }
 
 fn find_class(classes: NamedClasses, name: &str) -> Option<Vec<(char, char)>> {
-    match classes.binary_search(|&(s, _)| s.cmp(name)) {
-        BinarySearchResult::Found(i) => Some(classes[i].1.to_vec()),
-        BinarySearchResult::NotFound(_) => None,
+    match classes.binary_search_by(|&(s, _)| s.cmp(name)) {
+        Ok(i) => Some(classes[i].1.to_vec()),
+        Err(_) => None,
     }
 }
 
index 990d5a159f60d879216efd4df4350d6a6b77b1b3..72e0e559c805bb7f0192088050576b7e29d648f2 100644 (file)
@@ -38,6 +38,7 @@
 
 use std::cmp;
 use std::mem;
+use std::iter::repeat;
 use std::slice::SliceExt;
 use compile::{
     Program,
@@ -121,7 +122,7 @@ fn run(&mut self) -> CaptureLocs {
         let mut clist = &mut Threads::new(self.which, ninsts, ncaps);
         let mut nlist = &mut Threads::new(self.which, ninsts, ncaps);
 
-        let mut groups = Vec::from_elem(ncaps * 2, None);
+        let mut groups: Vec<_> = repeat(None).take(ncaps * 2).collect();
 
         // Determine if the expression starts with a '^' so we can avoid
         // simulating .*?
@@ -227,8 +228,7 @@ fn step(&self, groups: &mut [Option<uint>], nlist: &mut Threads,
                     let negate = flags & FLAG_NEGATED > 0;
                     let casei = flags & FLAG_NOCASE > 0;
                     let found = ranges.as_slice();
-                    let found = found.binary_search(|&rc| class_cmp(casei, c, rc))
-                        .found().is_some();
+                    let found = found.binary_search_by(|&rc| class_cmp(casei, c, rc)).is_ok();
                     if found ^ negate {
                         self.add(nlist, pc+1, caps);
                     }
@@ -457,10 +457,10 @@ impl Threads {
     fn new(which: MatchKind, num_insts: uint, ncaps: uint) -> Threads {
         Threads {
             which: which,
-            queue: Vec::from_fn(num_insts, |_| {
-                Thread { pc: 0, groups: Vec::from_elem(ncaps * 2, None) }
-            }),
-            sparse: Vec::from_elem(num_insts, 0u),
+            queue: range(0, num_insts).map(|_| {
+                Thread { pc: 0, groups: repeat(None).take(ncaps * 2).collect() }
+            }).collect(),
+            sparse: repeat(0u).take(num_insts).collect(),
             size: 0,
         }
     }
@@ -518,7 +518,7 @@ pub fn is_word(c: Option<char>) -> bool {
     // Try the common ASCII case before invoking binary search.
     match c {
         '_' | '0' ... '9' | 'a' ... 'z' | 'A' ... 'Z' => true,
-        _ => PERLW.binary_search(|&(start, end)| {
+        _ => PERLW.binary_search_by(|&(start, end)| {
             if c >= start && c <= end {
                 Equal
             } else if start > c {
@@ -526,7 +526,7 @@ pub fn is_word(c: Option<char>) -> bool {
             } else {
                 Less
             }
-        }).found().is_some()
+        }).is_ok()
     }
 }
 
index db29d0111f446bd9a431935a5e58fe408695300f..5d0532a621022eb6723685784600bb62014c8e37 100644 (file)
@@ -1599,7 +1599,7 @@ fn encode_index<T, F>(rbml_w: &mut Encoder, index: Vec<entry<T>>, mut write_fn:
     F: FnMut(&mut SeekableMemWriter, &T),
     T: Hash,
 {
-    let mut buckets: Vec<Vec<entry<T>>> = Vec::from_fn(256, |_| Vec::new());
+    let mut buckets: Vec<Vec<entry<T>>> = range(0, 256u16).map(|_| Vec::new()).collect();
     for elt in index.into_iter() {
         let h = hash::hash(&elt.val) as uint;
         buckets[h % 256].push(elt);
index b7e67ea4690594d7a2232f9f8b11e88264f27b64..522e1d4d3b284a571ca9e952e408264dfcff1d43 100644 (file)
@@ -611,9 +611,9 @@ fn is_useful(cx: &MatchCheckCtxt,
                             let arity = constructor_arity(cx, &c, left_ty);
                             let mut result = {
                                 let pat_slice = pats[];
-                                let subpats = Vec::from_fn(arity, |i| {
+                                let subpats: Vec<_> = range(0, arity).map(|i| {
                                     pat_slice.get(i).map_or(DUMMY_WILD_PAT, |p| &**p)
-                                });
+                                }).collect();
                                 vec![construct_witness(cx, &c, subpats, left_ty)]
                             };
                             result.extend(pats.into_iter().skip(arity));
@@ -635,7 +635,7 @@ fn is_useful(cx: &MatchCheckCtxt,
                 match is_useful(cx, &matrix, v.tail(), witness) {
                     UsefulWithWitness(pats) => {
                         let arity = constructor_arity(cx, &constructor, left_ty);
-                        let wild_pats = Vec::from_elem(arity, DUMMY_WILD_PAT);
+                        let wild_pats: Vec<_> = repeat(DUMMY_WILD_PAT).take(arity).collect();
                         let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
                         let mut new_pats = vec![enum_pat];
                         new_pats.extend(pats.into_iter());
@@ -788,7 +788,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
     } = raw_pat(r[col]);
     let head: Option<Vec<&Pat>> = match *node {
         ast::PatWild(_) =>
-            Some(Vec::from_elem(arity, DUMMY_WILD_PAT)),
+            Some(repeat(DUMMY_WILD_PAT).take(arity).collect()),
 
         ast::PatIdent(_, _, _) => {
             let opt_def = cx.tcx.def_map.borrow().get(&pat_id).cloned();
@@ -801,7 +801,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 } else {
                     None
                 },
-                _ => Some(Vec::from_elem(arity, DUMMY_WILD_PAT))
+                _ => Some(repeat(DUMMY_WILD_PAT).take(arity).collect())
             }
         }
 
@@ -815,7 +815,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 DefVariant(..) | DefStruct(..) => {
                     Some(match args {
                         &Some(ref args) => args.iter().map(|p| &**p).collect(),
-                        &None => Vec::from_elem(arity, DUMMY_WILD_PAT)
+                        &None => repeat(DUMMY_WILD_PAT).take(arity).collect(),
                     })
                 }
                 _ => None
@@ -894,13 +894,13 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
                 // Fixed-length vectors.
                 Single => {
                     let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
-                    pats.grow_fn(arity - before.len() - after.len(), |_| DUMMY_WILD_PAT);
+                    pats.extend(repeat(DUMMY_WILD_PAT).take(arity - before.len() - after.len()));
                     pats.extend(after.iter().map(|p| &**p));
                     Some(pats)
                 },
                 Slice(length) if before.len() + after.len() <= length && slice.is_some() => {
                     let mut pats: Vec<&Pat> = before.iter().map(|p| &**p).collect();
-                    pats.grow_fn(arity - before.len() - after.len(), |_| DUMMY_WILD_PAT);
+                    pats.extend(repeat(DUMMY_WILD_PAT).take(arity - before.len() - after.len()));
                     pats.extend(after.iter().map(|p| &**p));
                     Some(pats)
                 },
index a2d417ca345d8830312762bbffcf30f09d92b83b..6cf6065de19f0ee90e6942ac161cd4e88d5e91a4 100644 (file)
@@ -21,6 +21,7 @@
 use middle::ty;
 use std::io;
 use std::uint;
+use std::iter::repeat;
 use syntax::ast;
 use syntax::ast_util::IdRange;
 use syntax::visit;
@@ -203,9 +204,9 @@ pub fn new(tcx: &'a ty::ctxt<'tcx>,
 
         let entry = if oper.initial_value() { uint::MAX } else {0};
 
-        let gens = Vec::from_elem(num_nodes * words_per_id, 0);
-        let kills = Vec::from_elem(num_nodes * words_per_id, 0);
-        let on_entry = Vec::from_elem(num_nodes * words_per_id, entry);
+        let gens: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
+        let kills: Vec<_> = repeat(0).take(num_nodes * words_per_id).collect();
+        let on_entry: Vec<_> = repeat(entry).take(num_nodes * words_per_id).collect();
 
         let nodeid_to_index = build_nodeid_to_index(decl, cfg);
 
@@ -446,7 +447,7 @@ pub fn propagate(&mut self, cfg: &cfg::CFG, blk: &ast::Block) {
                 changed: true
             };
 
-            let mut temp = Vec::from_elem(words_per_id, 0u);
+            let mut temp: Vec<_> = repeat(0u).take(words_per_id).collect();
             while propcx.changed {
                 propcx.changed = false;
                 propcx.reset(temp.as_mut_slice());
index e38b721ce2d0d82295b130766566f4fcd83636be..6f1c7af5b8628671494ec222c0bd538d91769c36 100644 (file)
@@ -1187,7 +1187,7 @@ fn rebuild_arg_ty_or_output(&self,
         let mut new_ty = P(ty.clone());
         let mut ty_queue = vec!(ty);
         while !ty_queue.is_empty() {
-            let cur_ty = ty_queue.remove(0).unwrap();
+            let cur_ty = ty_queue.remove(0);
             match cur_ty.node {
                 ast::TyRptr(lt_opt, ref mut_ty) => {
                     let rebuild = match lt_opt {
index 386768bd9d6f75e402735290a90f2544d4d77689..91fbaca26d113fdc67f0a5e0b04c34d33a7f4ef8 100644 (file)
@@ -799,7 +799,7 @@ pub fn next_diverging_ty_var(&self) -> Ty<'tcx> {
     }
 
     pub fn next_ty_vars(&self, n: uint) -> Vec<Ty<'tcx>> {
-        Vec::from_fn(n, |_i| self.next_ty_var())
+        range(0, n).map(|_i| self.next_ty_var()).collect()
     }
 
     pub fn next_int_var_id(&self) -> IntVid {
index 97fab3bc9395a4796e5a19076d30cb86b3984809..7372bb267b06c853de1e77c1fe5e327af1cfb67f 100644 (file)
@@ -34,6 +34,7 @@
 
 use std::cell::{Cell, RefCell};
 use std::u32;
+use std::iter::repeat;
 use syntax::ast;
 
 mod doc;
@@ -975,7 +976,7 @@ fn infer_variable_values(&self,
     }
 
     fn construct_var_data(&self) -> Vec<VarData> {
-        Vec::from_fn(self.num_vars() as uint, |_| {
+        range(0, self.num_vars() as uint).map(|_| {
             VarData {
                 // All nodes are initially classified as contracting; during
                 // the expansion phase, we will shift the classification for
@@ -984,7 +985,7 @@ fn construct_var_data(&self) -> Vec<VarData> {
                 classification: Contracting,
                 value: NoValue,
             }
-        })
+        }).collect()
     }
 
     fn dump_constraints(&self) {
@@ -1247,7 +1248,7 @@ fn extract_values_and_collect_conflicts(
         // idea is to report errors that derive from independent
         // regions of the graph, but not those that derive from
         // overlapping locations.
-        let mut dup_vec = Vec::from_elem(self.num_vars() as uint, u32::MAX);
+        let mut dup_vec: Vec<_> = repeat(u32::MAX).take(self.num_vars() as uint).collect();
 
         let mut opt_graph = None;
 
@@ -1308,7 +1309,7 @@ fn extract_values_and_collect_conflicts(
             }
         }
 
-        Vec::from_fn(self.num_vars() as uint, |idx| var_data[idx].value)
+        range(0, self.num_vars() as uint).map(|idx| var_data[idx].value).collect()
     }
 
     fn construct_graph(&self) -> RegionGraph {
index d3859ca12a9711930b26f2dcaac566daf6eafabb..5be8d03e74359306afe6012ecda7e15ea5fb7abd 100644 (file)
 
 use std::{fmt, io, uint};
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::ast::{mod, NodeId, Expr};
 use syntax::codemap::{BytePos, original_sp, Span};
 use syntax::parse::token::{mod, special_idents};
@@ -575,8 +576,8 @@ fn new(ir: &'a mut IrMaps<'a, 'tcx>, specials: Specials) -> Liveness<'a, 'tcx> {
         Liveness {
             ir: ir,
             s: specials,
-            successors: Vec::from_elem(num_live_nodes, invalid_node()),
-            users: Vec::from_elem(num_live_nodes * num_vars, invalid_users()),
+            successors: repeat(invalid_node()).take(num_live_nodes).collect(),
+            users: repeat(invalid_users()).take(num_live_nodes * num_vars).collect(),
             loop_scope: Vec::new(),
             break_ln: NodeMap::new(),
             cont_ln: NodeMap::new(),
@@ -1068,7 +1069,7 @@ fn propagate_through_expr(&mut self, expr: &Expr, succ: LiveNode)
                 // the same bindings, and we also consider the first pattern to be
                 // the "authoritative" set of ids
                 let arm_succ =
-                    self.define_bindings_in_arm_pats(arm.pats.head().map(|p| &**p),
+                    self.define_bindings_in_arm_pats(arm.pats.first().map(|p| &**p),
                                                      guard_succ);
                 self.merge_from_succ(ln, arm_succ, first_merge);
                 first_merge = false;
@@ -1436,7 +1437,7 @@ fn check_arm(this: &mut Liveness, arm: &ast::Arm) {
     // only consider the first pattern; any later patterns must have
     // the same bindings, and we also consider the first pattern to be
     // the "authoritative" set of ids
-    this.arm_pats_bindings(arm.pats.head().map(|p| &**p), |this, ln, var, sp, id| {
+    this.arm_pats_bindings(arm.pats.first().map(|p| &**p), |this, ln, var, sp, id| {
         this.warn_about_unused(sp, id, ln, var);
     });
     visit::walk_arm(this, arm);
@@ -1542,7 +1543,7 @@ fn check_ret(&self,
                 } else {
                     let ends_with_stmt = match body.expr {
                         None if body.stmts.len() > 0 =>
-                            match body.stmts.last().unwrap().node {
+                            match body.stmts.first().unwrap().node {
                                 ast::StmtSemi(ref e, _) => {
                                     ty::expr_ty(self.ir.tcx, &**e) == t_ret
                                 },
@@ -1553,7 +1554,7 @@ fn check_ret(&self,
                     self.ir.tcx.sess.span_err(
                         sp, "not all control paths return a value");
                     if ends_with_stmt {
-                        let last_stmt = body.stmts.last().unwrap();
+                        let last_stmt = body.stmts.first().unwrap();
                         let original_span = original_sp(self.ir.tcx.sess.codemap(),
                                                         last_stmt.span, sp);
                         let span_semicolon = Span {
index 730da26eda3dccc50f2fd722ffc334596191d193..edba2839f37eabc9476b5c8a85df7aae6e9d74de 100644 (file)
@@ -751,10 +751,7 @@ fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
         let orig_def = self.tcx.def_map.borrow()[path_id].clone();
         let ck = |tyname: &str| {
             let ck_public = |def: ast::DefId| {
-                let name = token::get_ident(path.segments
-                                                .last()
-                                                .unwrap()
-                                                .identifier);
+                let name = token::get_ident(path.segments.last().unwrap().identifier);
                 let origdid = orig_def.def_id();
                 self.ensure_public(span,
                                    def,
index 4feafff3b9211bb1ed823a84906d5b715e9017df..e9504a92f7b460ef714c3d9f24faef02dc88e8da 100644 (file)
@@ -296,7 +296,7 @@ fn visit_early_late<F>(&mut self,
         debug!("visit_early_late: referenced_idents={}",
                referenced_idents);
 
-        let (early, late) = generics.lifetimes.clone().partition(
+        let (early, late): (Vec<_>, _) = generics.lifetimes.iter().cloned().partition(
             |l| referenced_idents.iter().any(|&i| i == l.lifetime.name));
 
         self.with(EarlyScope(early_space, &early, self.scope), move |old_scope, this| {
index 3066ae5b479ef7aeaa03ea51b3ea78af1210bb69..07da9853e558525d280845190bd51a345730bac9 100644 (file)
@@ -323,7 +323,11 @@ pub fn pop(&mut self, space: ParamSpace) -> Option<T> {
                 SelfSpace => { self.self_limit -= 1; }
                 FnSpace => {}
             }
-            self.content.remove(limit - 1)
+            if self.content.is_empty() {
+                None
+            } else {
+                Some(self.content.remove(limit - 1))
+            }
         }
     }
 
index 24e9883744407b9ebb698e2caa6f4f6a8278cdda..e7c77b12499274360e9f3ce7bacbe6a75b87c836 100644 (file)
@@ -14,7 +14,7 @@ pub fn lev_distance(me: &str, t: &str) -> uint {
     if me.is_empty() { return t.chars().count(); }
     if t.is_empty() { return me.chars().count(); }
 
-    let mut dcol = Vec::from_fn(t.len() + 1, |x| x);
+    let mut dcol: Vec<_> = range(0, t.len() + 1).collect();
     let mut t_last = 0;
 
     for (i, sc) in me.chars().enumerate() {
index e1f0168d86be45e59827499870eea5e0333aed96..a7d1d3a23bd1345c941e74a729001fc690f7f4f2 100644 (file)
@@ -14,7 +14,7 @@
 
 #![allow(deprecated)] // to_be32
 
-use std::iter::range_step;
+use std::iter::{range_step, repeat};
 use std::num::Int;
 use std::slice::bytes::{MutableByteVector, copy_memory};
 use serialize::hex::ToHex;
@@ -258,7 +258,7 @@ fn input_str(&mut self, input: &str) {
     /// Convenience function that retrieves the result of a digest as a
     /// newly allocated vec of bytes.
     fn result_bytes(&mut self) -> Vec<u8> {
-        let mut buf = Vec::from_elem((self.output_bits()+7)/8, 0u8);
+        let mut buf: Vec<u8> = repeat(0u8).take((self.output_bits()+7)/8).collect();
         self.result(buf.as_mut_slice());
         buf
     }
@@ -612,7 +612,7 @@ fn test_sha256() {
     /// correct.
     fn test_digest_1million_random<D: Digest>(digest: &mut D, blocksize: uint, expected: &str) {
         let total_size = 1000000;
-        let buffer = Vec::from_elem(blocksize * 2, 'a' as u8);
+        let buffer: Vec<u8> = repeat('a' as u8).take(blocksize * 2).collect();
         let mut rng = IsaacRng::new_unseeded();
         let mut count = 0;
 
index 7609554033cef5021c56421362d0eb388d039591..070ae1151aa6d4701e305057cd84bdb4471b9662 100644 (file)
@@ -25,7 +25,6 @@
 use rustc::util::ppaux::{Repr, UserString};
 use std::mem;
 use std::rc::Rc;
-use std::slice;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::attr::AttrMetaMethods;
@@ -268,9 +267,9 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
     return;
 
     fn non_member(elem: MovePathIndex, set: &[MovePathIndex]) -> bool {
-        match set.binary_search_elem(&elem) {
-            slice::BinarySearchResult::Found(_) => false,
-            slice::BinarySearchResult::NotFound(_) => true,
+        match set.binary_search(&elem) {
+            Ok(_) => false,
+            Err(_) => true,
         }
     }
 }
index e71e9e5dfea1b87728a9bd6170044e5849471207..664d470b11bd1c46ad6a228946272b712f8ad6f5 100644 (file)
@@ -37,4 +37,3 @@
 mod borrowck;
 
 pub mod graphviz;
-
index e20404bf63891431031c6306c5f5eaf4fcaad563..0d98434d042ba91f672d6f6a172925ec1ead6f02 100644 (file)
@@ -265,11 +265,13 @@ fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
         lints
     }
 
-    let (plugin, builtin) = lint_store.get_lints().partitioned(|&(_, p)| p);
+    let (plugin, builtin): (Vec<_>, _) = lint_store.get_lints()
+        .iter().cloned().partition(|&(_, p)| p);
     let plugin = sort_lints(plugin);
     let builtin = sort_lints(builtin);
 
-    let (plugin_groups, builtin_groups) = lint_store.get_lint_groups().partitioned(|&(_, _, p)| p);
+    let (plugin_groups, builtin_groups): (Vec<_>, _) = lint_store.get_lint_groups()
+        .iter().cloned().partition(|&(_, _, p)| p);
     let plugin_groups = sort_lint_groups(plugin_groups);
     let builtin_groups = sort_lint_groups(builtin_groups);
 
@@ -377,7 +379,7 @@ fn describe_codegen_flags() {
 /// returns None.
 pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
     // Throw away the first argument, the name of the binary
-    let _binary = args.remove(0).unwrap();
+    let _binary = args.remove(0);
 
     if args.is_empty() {
         // user did not write `-v` nor `-Z unstable-options`, so do not
index 52bd096eb83dea2f5b45f0675d02a0ddae1ff6f2..cc240915e9d7be579652f18a30b51d5d53a59365 100644 (file)
@@ -4828,9 +4828,7 @@ fn resolve_type(&mut self, ty: &Ty) {
                             Some(def) => {
                                 debug!("(resolving type) resolved `{}` to \
                                         type {}",
-                                       token::get_ident(path.segments
-                                                            .last().unwrap()
-                                                            .identifier),
+                                       token::get_ident(path.segments.last().unwrap() .identifier),
                                        def);
                                 result_def = Some(def);
                             }
@@ -5021,19 +5019,13 @@ struct or enum variant",
                             self.resolve_error(path.span,
                                 format!("`{}` is not an enum variant, struct or const",
                                     token::get_ident(
-                                        path.segments
-                                            .last()
-                                            .unwrap()
-                                            .identifier))[]);
+                                        path.segments.last().unwrap().identifier))[]);
                         }
                         None => {
                             self.resolve_error(path.span,
                                 format!("unresolved enum variant, struct or const `{}`",
                                     token::get_ident(
-                                        path.segments
-                                            .last()
-                                            .unwrap()
-                                            .identifier))[]);
+                                        path.segments.last().unwrap().identifier))[]);
                         }
                     }
 
@@ -5187,9 +5179,7 @@ fn resolve_path(&mut self,
 
         // Try to find a path to an item in a module.
         let unqualified_def =
-                self.resolve_identifier(path.segments
-                                            .last().unwrap()
-                                            .identifier,
+                self.resolve_identifier(path.segments.last().unwrap().identifier,
                                         namespace,
                                         check_ribs,
                                         path.span);
index 0e37cd0f3b8d62cb1d275dd8d28fd48257272841..c6e4ce9457b533ba764480a276163ee6bfbf5bb9 100644 (file)
@@ -606,9 +606,9 @@ fn extract_variant_args<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                     val: ValueRef)
                                     -> ExtractedBlock<'blk, 'tcx> {
     let _icx = push_ctxt("match::extract_variant_args");
-    let args = Vec::from_fn(adt::num_args(repr, disr_val), |i| {
+    let args = range(0, adt::num_args(repr, disr_val)).map(|i| {
         adt::trans_field_ptr(bcx, repr, val, disr_val, i)
-    });
+    }).collect();
 
     ExtractedBlock { vals: args, bcx: bcx }
 }
index 9b678a4f3ae9b7d502a1b8d370d1e19e7329f48e..fffdc9c97ab97e41fa73be0b562b865664efe755 100644 (file)
@@ -23,6 +23,7 @@
 use trans::type_::Type;
 
 use std::cmp;
+use std::iter::repeat;
 
 #[deriving(Clone, Copy, PartialEq)]
 enum RegClass {
@@ -286,7 +287,7 @@ fn fixup(ty: Type, cls: &mut [RegClass]) {
     }
 
     let words = (ty_size(ty) + 7) / 8;
-    let mut cls = Vec::from_elem(words, NoClass);
+    let mut cls: Vec<_> = repeat(NoClass).take(words).collect();
     if words > 4 {
         all_mem(cls.as_mut_slice());
         return cls;
index 0fd6d286e8b2de2dff8be49bcabc325d69491440..1f01da8a124b3c7309e82460b2012c7964d19fdf 100644 (file)
@@ -25,6 +25,7 @@
 use util::ppaux::{Repr, ty_to_string};
 
 use std::c_str::ToCStr;
+use std::iter::repeat;
 use libc::c_uint;
 use syntax::{ast, ast_util};
 use syntax::ptr::P;
@@ -608,7 +609,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
                 const_eval::const_uint(i) => i as uint,
                 _ => cx.sess().span_bug(count.span, "count must be integral const expression.")
             };
-            let vs = Vec::from_elem(n, const_expr(cx, &**elem).0);
+            let vs: Vec<_> = repeat(const_expr(cx, &**elem).0).take(n).collect();
             if vs.iter().any(|vi| val_ty(*vi) != llunitty) {
                 C_struct(cx, vs[], false)
             } else {
index b5b1c6ff86479a1b1544ca7e540239162a7fb0f5..f191976e23ce8869324268ed26649cdc31c5c014 100644 (file)
@@ -3396,10 +3396,7 @@ fn walk_pattern(cx: &CrateContext,
                     if need_new_scope {
                         // Create a new lexical scope and push it onto the stack
                         let loc = cx.sess().codemap().lookup_char_pos(pat.span.lo);
-                        let file_metadata = file_metadata(cx,
-                                                          loc.file
-                                                             .name
-                                                             []);
+                        let file_metadata = file_metadata(cx, loc.file.name[]);
                         let parent_scope = scope_stack.last().unwrap().scope_metadata;
 
                         let scope_metadata = unsafe {
index 5a20a297fdb09ddfe569910aacb421738310bd9e..7587adae5b7ef68b3a30908c8c9e9fc834ba6d9a 100644 (file)
@@ -68,6 +68,7 @@
 use syntax::ptr::P;
 use syntax::parse::token;
 use std::rc::Rc;
+use std::iter::repeat;
 
 // Destinations
 
@@ -1413,7 +1414,7 @@ fn trans_struct<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
 
     let tcx = bcx.tcx();
     with_field_tys(tcx, ty, Some(expr_id), |discr, field_tys| {
-        let mut need_base = Vec::from_elem(field_tys.len(), true);
+        let mut need_base: Vec<_> = repeat(true).take(field_tys.len()).collect();
 
         let numbered_fields = fields.iter().map(|field| {
             let opt_pos =
index 45a2a343066c46e5aca02906e2f3473eb14b8a3d..2cc40a617950843affa2364d296169b9e6039195 100644 (file)
@@ -22,6 +22,7 @@
 use std::c_str::ToCStr;
 use std::mem;
 use std::cell::RefCell;
+use std::iter::repeat;
 
 use libc::c_uint;
 
@@ -282,7 +283,7 @@ pub fn field_types(&self) -> Vec<Type> {
             if n_elts == 0 {
                 return Vec::new();
             }
-            let mut elts = Vec::from_elem(n_elts, Type { rf: 0 as TypeRef });
+            let mut elts: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_elts).collect();
             llvm::LLVMGetStructElementTypes(self.to_ref(),
                                             elts.as_mut_ptr() as *mut TypeRef);
             elts
@@ -296,7 +297,7 @@ pub fn return_type(&self) -> Type {
     pub fn func_params(&self) -> Vec<Type> {
         unsafe {
             let n_args = llvm::LLVMCountParamTypes(self.to_ref()) as uint;
-            let mut args = Vec::from_elem(n_args, Type { rf: 0 as TypeRef });
+            let mut args: Vec<_> = repeat(Type { rf: 0 as TypeRef }).take(n_args).collect();
             llvm::LLVMGetParamTypes(self.to_ref(),
                                     args.as_mut_ptr() as *mut TypeRef);
             args
index 587a85cfcbac4cd7e9d93960aad02260ce026397..dee9aafd06d7bfc561420daf53b0eee36aa61c59 100644 (file)
@@ -62,7 +62,7 @@
 use util::ppaux::{mod, Repr, UserString};
 
 use std::rc::Rc;
-use std::iter::AdditiveIterator;
+use std::iter::{repeat, AdditiveIterator};
 use syntax::{abi, ast, ast_util};
 use syntax::codemap::Span;
 use syntax::parse::token;
@@ -317,8 +317,8 @@ fn create_substs_for_ast_path<'tcx,AC,RS>(
 
         match anon_regions {
             Ok(v) => v.into_iter().collect(),
-            Err(_) => Vec::from_fn(expected_num_region_params,
-                                   |_| ty::ReStatic) // hokey
+            Err(_) => range(0, expected_num_region_params)
+                          .map(|_| ty::ReStatic).collect() // hokey
         }
     };
 
@@ -500,7 +500,7 @@ fn convert_parenthesized_parameters<'tcx,AC>(this: &AC,
                             .map(|a_t| ast_ty_to_ty(this, &binding_rscope, &**a_t))
                             .collect::<Vec<Ty<'tcx>>>();
 
-    let input_params = Vec::from_elem(inputs.len(), String::new());
+    let input_params: Vec<_> = repeat(String::new()).take(inputs.len()).collect();
     let (implied_output_region,
          params_lifetimes) = find_implied_output_region(&*inputs, input_params);
 
@@ -734,8 +734,8 @@ pub fn ast_path_to_ty_relaxed<'tcx,AC,RS>(
         path.segments.iter().all(|s| s.parameters.is_empty());
 
     let substs = if needs_defaults {
-        let type_params = Vec::from_fn(generics.types.len(TypeSpace),
-                                       |_| this.ty_infer(path.span));
+        let type_params: Vec<_> = range(0, generics.types.len(TypeSpace))
+                                      .map(|_| this.ty_infer(path.span)).collect();
         let region_params =
             rscope.anon_regions(path.span, generics.regions.len(TypeSpace))
                   .unwrap();
@@ -1528,21 +1528,18 @@ fn conv_ty_poly_trait_ref<'tcx, AC, RS>(
     let mut partitioned_bounds = partition_bounds(this.tcx(), span, ast_bounds[]);
 
     let mut projection_bounds = Vec::new();
-    let main_trait_bound = match partitioned_bounds.trait_bounds.remove(0) {
-        Some(trait_bound) => {
-            let ptr = instantiate_poly_trait_ref(this,
-                                                 rscope,
-                                                 trait_bound,
-                                                 None,
-                                                 &mut projection_bounds);
-            Some(ptr)
-        }
-        None => {
-            this.tcx().sess.span_err(
-                span,
-                "at least one non-builtin trait is required for an object type");
-            None
-        }
+    let main_trait_bound = if !partitioned_bounds.trait_bounds.is_empty() {
+        let trait_bound = partitioned_bounds.trait_bounds.remove(0);
+        Some(instantiate_poly_trait_ref(this,
+                                        rscope,
+                                        trait_bound,
+                                        None,
+                                        &mut projection_bounds))
+    } else {
+        this.tcx().sess.span_err(
+            span,
+            "at least one non-builtin trait is required for an object type");
+        None
     };
 
     let bounds =
index 0e8b5b373f14471c4c05b89f93d46474a8ee97a8..7c431b4fc0bd065279edc29078605de20e4a70c8 100644 (file)
@@ -124,7 +124,8 @@ pub fn check_pat<'a, 'tcx>(pcx: &pat_ctxt<'a, 'tcx>,
             check_pat_struct(pcx, pat, path, fields.as_slice(), etc, expected);
         }
         ast::PatTup(ref elements) => {
-            let element_tys = Vec::from_fn(elements.len(), |_| fcx.infcx().next_ty_var());
+            let element_tys: Vec<_> = range(0, elements.len()).map(|_| fcx.infcx()
+                .next_ty_var()).collect();
             let pat_ty = ty::mk_tup(tcx, element_tys.clone());
             fcx.write_ty(pat.id, pat_ty);
             demand::eqtype(fcx, pat.span, expected, pat_ty);
index a189f780b0c270e2956f256acac4f2f84970752f..a751b65a0f8c58233cacd91266082958ded4b931 100644 (file)
@@ -24,6 +24,7 @@
 use syntax::codemap::Span;
 use std::rc::Rc;
 use std::mem;
+use std::iter::repeat;
 use util::ppaux::Repr;
 
 struct ConfirmContext<'a, 'tcx:'a> {
@@ -339,7 +340,7 @@ fn instantiate_method_substs(&mut self,
             } else if num_supplied_types != num_method_types {
                 span_err!(self.tcx().sess, self.span, E0036,
                     "incorrect number of type parameters given for this method");
-                Vec::from_elem(num_method_types, self.tcx().types.err)
+                repeat(self.tcx().types.err).take(num_method_types).collect()
             } else {
                 supplied_method_types
             }
index 8069d00dda826fc8f4aa002b305e890e29d92267..f3a4a8d177e233b1153f1423b4ed7ebcb2b5c55a 100644 (file)
 use std::cell::{Cell, Ref, RefCell};
 use std::mem::replace;
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::{mod, abi, attr};
 use syntax::ast::{mod, ProvidedMethod, RequiredMethod, TypeTraitItem, DefId};
 use syntax::ast_util::{mod, local_def, PostExpansionMethod};
@@ -2130,9 +2131,9 @@ fn default_region_bound(&self, span: Span) -> Option<ty::Region> {
 
     fn anon_regions(&self, span: Span, count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>> {
-        Ok(Vec::from_fn(count, |_| {
+        Ok(range(0, count).map(|_| {
             self.infcx().next_region_var(infer::MiscVariable(span))
-        }))
+        }).collect())
     }
 }
 
@@ -2810,7 +2811,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
 
 // FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
 fn err_args<'tcx>(tcx: &ty::ctxt<'tcx>, len: uint) -> Vec<Ty<'tcx>> {
-    Vec::from_fn(len, |_| tcx.types.err)
+    range(0, len).map(|_| tcx.types.err).collect()
 }
 
 fn write_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
@@ -5166,7 +5167,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
     // The first step then is to categorize the segments appropriately.
 
     assert!(path.segments.len() >= 1);
-    let mut segment_spaces;
+    let mut segment_spaces: Vec<_>;
     match def {
         // Case 1 and 1b. Reference to a *type* or *enum variant*.
         def::DefSelfTy(..) |
@@ -5181,7 +5182,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefTyParam(..) => {
             // Everything but the final segment should have no
             // parameters at all.
-            segment_spaces = Vec::from_elem(path.segments.len() - 1, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 1).collect();
             segment_spaces.push(Some(subst::TypeSpace));
         }
 
@@ -5189,7 +5190,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefFn(..) |
         def::DefConst(..) |
         def::DefStatic(..) => {
-            segment_spaces = Vec::from_elem(path.segments.len() - 1, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 1).collect();
             segment_spaces.push(Some(subst::FnSpace));
         }
 
@@ -5205,7 +5206,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 def::FromImpl(_) => {}
             }
 
-            segment_spaces = Vec::from_elem(path.segments.len() - 2, None);
+            segment_spaces = repeat(None).take(path.segments.len() - 2).collect();
             segment_spaces.push(Some(subst::TypeSpace));
             segment_spaces.push(Some(subst::FnSpace));
         }
@@ -5220,7 +5221,7 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         def::DefRegion(..) |
         def::DefLabel(..) |
         def::DefUpvar(..) => {
-            segment_spaces = Vec::from_elem(path.segments.len(), None);
+            segment_spaces = repeat(None).take(path.segments.len()).collect();
         }
     }
     assert_eq!(segment_spaces.len(), path.segments.len());
@@ -5489,8 +5490,7 @@ fn adjust_type_parameters<'a, 'tcx>(
                 "too few type parameters provided: expected {}{} parameter(s) \
                 , found {} parameter(s)",
                 qualifier, required_len, provided_len);
-            substs.types.replace(space,
-                                 Vec::from_elem(desired.len(), fcx.tcx().types.err));
+            substs.types.replace(space, repeat(fcx.tcx().types.err).take(desired.len()).collect());
             return;
         }
 
@@ -5614,7 +5614,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
 
     // make a vector of booleans initially false, set to true when used
     if tps.len() == 0u { return; }
-    let mut tps_used = Vec::from_elem(tps.len(), false);
+    let mut tps_used: Vec<_> = repeat(false).take(tps.len()).collect();
 
     ty::walk_ty(ty, |t| {
             match t.sty {
index bb051ab15250ca9cdbc97ef764a5f17bcf9a97d9..42ffe2d5327bc4eb85a520c942dba6252b968d99 100644 (file)
@@ -409,4 +409,3 @@ fn repr(&self, tcx: &ty::ctxt) -> String {
         }
     }
 }
-
index a97dce88a57628d78c01bda81d2c23fc62625a34..c62218313f4e810142640a3d8a15feaa897dded5 100644 (file)
@@ -13,6 +13,7 @@
 use middle::ty_fold;
 
 use std::cell::Cell;
+use std::iter::repeat;
 use syntax::codemap::Span;
 
 /// Defines strategies for handling regions that are omitted.  For
@@ -99,7 +100,7 @@ fn anon_regions(&self,
                     count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
     {
-        Ok(Vec::from_elem(count, self.default))
+        Ok(repeat(self.default).take(count).collect())
     }
 }
 
@@ -134,7 +135,7 @@ fn anon_regions(&self,
                     count: uint)
                     -> Result<Vec<ty::Region>, Option<Vec<(String, uint)>>>
     {
-        Ok(Vec::from_fn(count, |_| self.next_region()))
+        Ok(range(0, count).map(|_| self.next_region()).collect())
     }
 }
 
index c4c33f24f87e2d9b4a57198514ccaec34ac6608f..de0b0a7ad3548e75c444d457c0b7944e15711cb0 100644 (file)
 use middle::ty::{mod, Ty};
 use std::fmt;
 use std::rc::Rc;
+use std::iter::repeat;
 use syntax::ast;
 use syntax::ast_map;
 use syntax::ast_util;
@@ -971,7 +972,7 @@ struct SolveContext<'a, 'tcx: 'a> {
 
 fn solve_constraints(constraints_cx: ConstraintContext) {
     let ConstraintContext { terms_cx, constraints, .. } = constraints_cx;
-    let solutions = Vec::from_elem(terms_cx.num_inferred(), ty::Bivariant);
+    let solutions: Vec<_> = repeat(ty::Bivariant).take(terms_cx.num_inferred()).collect();
     let mut solutions_cx = SolveContext {
         terms_cx: terms_cx,
         constraints: constraints,
index dc264a5b5aa05526c1edfbc6698c935e62b2598f..3c09a10f3d98ed651dd4447540d0bf6c25b4df0c 100644 (file)
@@ -398,7 +398,7 @@ fn primitive_link(f: &mut fmt::Formatter,
                 Some(root) => {
                     try!(write!(f, "<a href='{}{}/primitive.{}.html'>",
                                 root,
-                                path.0.head().unwrap(),
+                                path.0.first().unwrap(),
                                 prim.to_url_str()));
                     needs_termination = true;
                 }
index bfb03cb2589c2a3366ed6b48d7b3805c50abb5c5..f8a0b88b4088d99ac4ffcf7fbf56771f3d7d359a 100644 (file)
@@ -1799,7 +1799,7 @@ fn trait_item(w: &mut fmt::Formatter, m: &clean::TraitMethod)
     try!(write!(w, r#"<script type="text/javascript" async
                               src="{root_path}/implementors/{path}/{ty}.{name}.js">
                       </script>"#,
-                root_path = Vec::from_elem(cx.current.len(), "..").connect("/"),
+                root_path = repeat("..").take(cx.current.len()).collect::<Vec<_>>().connect("/"),
                 path = if ast_util::is_local(it.def_id) {
                     cx.current.connect("/")
                 } else {
@@ -2055,7 +2055,8 @@ fn render_struct(w: &mut fmt::Formatter, it: &clean::Item,
 fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
     match cache().impls.get(&it.def_id) {
         Some(v) => {
-            let (non_trait, traits) = v.partitioned(|i| i.impl_.trait_.is_none());
+            let (non_trait, traits): (Vec<_>, _) = v.iter().cloned()
+                .partition(|i| i.impl_.trait_.is_none());
             if non_trait.len() > 0 {
                 try!(write!(w, "<h2 id='methods'>Methods</h2>"));
                 for i in non_trait.iter() {
@@ -2065,7 +2066,8 @@ fn render_methods(w: &mut fmt::Formatter, it: &clean::Item) -> fmt::Result {
             if traits.len() > 0 {
                 try!(write!(w, "<h2 id='implementations'>Trait \
                                   Implementations</h2>"));
-                let (derived, manual) = traits.partition(|i| i.impl_.derived);
+                let (derived, manual): (Vec<_>, _) = traits.into_iter()
+                    .partition(|i| i.impl_.derived);
                 for i in manual.iter() {
                     try!(render_impl(w, i));
                 }
index f28abcc10cfd8dcf0d651005566e08a61a67834c..7c6cfb337dc4622997060cbfb8591cec652f8ff6 100644 (file)
@@ -74,7 +74,7 @@
 use hash;
 use mem;
 use ptr;
-use slice::{mod, ImmutableIntSlice};
+use slice::{mod, IntSliceExt};
 use str;
 use string::String;
 use core::kinds::marker;
index 82ec1814ebde70e05ac4f957d702d55e6b91c7b8..a8004155af06d7bde0a02a57ac9b1b3af2223d24 100644 (file)
@@ -148,7 +148,7 @@ pub fn new(cap: uint) -> Packet<T> {
                     tail: 0 as *mut Node,
                 },
                 buf: Buffer {
-                    buf: Vec::from_fn(cap + if cap == 0 {1} else {0}, |_| None),
+                    buf: range(0, cap + if cap == 0 {1} else {0}).map(|_| None).collect(),
                     start: 0,
                     size: 0,
                 },
index fdbce101c1d6c3ddef3cc6a9fa688e784346a7e2..0fba0f6704be4bac990c9f2dbd06c632f5904b33 100644 (file)
@@ -439,9 +439,10 @@ pub struct ShortReader {
 
     impl Reader for ShortReader {
         fn read(&mut self, _: &mut [u8]) -> io::IoResult<uint> {
-            match self.lengths.remove(0) {
-                Some(i) => Ok(i),
-                None => Err(io::standard_error(io::EndOfFile))
+            if self.lengths.is_empty() {
+                Err(io::standard_error(io::EndOfFile))
+            } else {
+                Ok(self.lengths.remove(0))
             }
         }
     }
index 989f44f7b8e4239326adf25ac0ec1be2cf154474..a9d9607395ce52997ca3549ad2354776cd093459 100644 (file)
@@ -620,10 +620,11 @@ pub fn get_exit_status() -> int {
 unsafe fn load_argc_and_argv(argc: int,
                              argv: *const *const c_char) -> Vec<Vec<u8>> {
     use c_str::CString;
+    use iter::range;
 
-    Vec::from_fn(argc as uint, |i| {
+    range(0, argc as uint).map(|i| {
         CString::new(*argv.offset(i as int), false).as_bytes_no_nul().to_vec()
-    })
+    }).collect()
 }
 
 /// Returns the command line arguments
@@ -721,7 +722,7 @@ fn real_args() -> Vec<String> {
     let lpCmdLine = unsafe { GetCommandLineW() };
     let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
 
-    let args = Vec::from_fn(nArgs as uint, |i| unsafe {
+    let args: Vec<_> = range(0, nArgs as uint).map(|i| unsafe {
         // Determine the length of this argument.
         let ptr = *szArgList.offset(i as int);
         let mut len = 0;
@@ -732,7 +733,7 @@ fn real_args() -> Vec<String> {
         let buf = slice::from_raw_buf(&ptr, len);
         let opt_s = String::from_utf16(sys::os::truncate_utf16_at_nul(buf));
         opt_s.ok().expect("CommandLineToArgvW returned invalid UTF-16")
-    });
+    }).collect();
 
     unsafe {
         LocalFree(szArgList as *mut c_void);
index 41cbaa2b8076b893ed1e2d82022af44d66e361f7..bd4031e623085ee0c1263833ba9eef187918c109 100644 (file)
@@ -29,7 +29,7 @@
 use super::{BytesContainer, GenericPath, GenericPathUnsafe};
 
 /// Iterator that yields successive components of a Path as &[u8]
-pub type Components<'a> = Splits<'a, u8, fn(&u8) -> bool>;
+pub type Components<'a> = Split<'a, u8, fn(&u8) -> bool>;
 
 /// Iterator that yields successive components of a Path as Option<&str>
 pub type StrComponents<'a> =
index 165d2c32416b0ae317f750227ada2b281f539cb3..751ed4b70fb38fa1646c49a1b5ae47217d45d0ea 100644 (file)
@@ -25,8 +25,8 @@
 use mem;
 use option::Option;
 use option::Option::{Some, None};
-use slice::{AsSlice, SliceExt, SliceConcatExt};
-use str::{CharSplits, FromStr, Str, StrAllocating, StrPrelude};
+use slice::{SliceExt, SliceConcatExt};
+use str::{SplitTerminator, FromStr, StrExt};
 use string::{String, ToString};
 use unicode::char::UnicodeChar;
 use vec::Vec;
index b1f268597c7ad99fb83df15edd9f7d6a2d652183..98eff621ce0f3c95c3c28552ff007b2e5b29a7ae 100644 (file)
@@ -95,14 +95,14 @@ fn get_global_ptr() -> *mut Option<Box<Vec<Vec<u8>>>> {
     }
 
     unsafe fn load_argc_and_argv(argc: int, argv: *const *const u8) -> Vec<Vec<u8>> {
-        Vec::from_fn(argc as uint, |i| {
+        range(0, argc as uint).map(|i| {
             let arg = *argv.offset(i as int);
             let mut len = 0u;
             while *arg.offset(len as int) != 0 {
                 len += 1u;
             }
             slice::from_raw_buf(&arg, len).to_vec()
-        })
+        }).collect()
     }
 
     #[cfg(test)]
index fe393b81e3d9a0a0f4194d3df54e1e28a08600c1..c0ef89666c0f59b16885ee4a1ce6369ace8af752 100644 (file)
@@ -120,9 +120,9 @@ fn insert(t: Box<Inner>, active: &mut Vec<Box<Inner>>) {
     // signals the first requests in the queue, possible re-enqueueing it.
     fn signal(active: &mut Vec<Box<Inner>>,
               dead: &mut Vec<(uint, Box<Inner>)>) {
-        let mut timer = match active.remove(0) {
-            Some(timer) => timer, None => return
-        };
+        if active.is_empty() { return }
+
+        let mut timer = active.remove(0);
         let mut cb = timer.cb.take().unwrap();
         cb.call();
         if timer.repeat {
@@ -178,7 +178,7 @@ fn signal(active: &mut Vec<Box<Inner>>,
                         Ok(RemoveTimer(id, ack)) => {
                             match dead.iter().position(|&(i, _)| id == i) {
                                 Some(i) => {
-                                    let (_, i) = dead.remove(i).unwrap();
+                                    let (_, i) = dead.remove(i);
                                     ack.send(i);
                                     continue
                                 }
@@ -186,7 +186,7 @@ fn signal(active: &mut Vec<Box<Inner>>,
                             }
                             let i = active.iter().position(|i| i.id == id);
                             let i = i.expect("no timer found");
-                            let t = active.remove(i).unwrap();
+                            let t = active.remove(i);
                             ack.send(t);
                         }
                         Err(..) => break
index fa08290a888e9f3a2f86d1dcc303eec09aae1e2e..210feb9aee7b2526f5aa939f4fd2b71349671af2 100644 (file)
@@ -17,6 +17,7 @@
 
 use fmt;
 use io::{IoResult, IoError};
+use iter::repeat;
 use libc::{c_int, c_char, c_void};
 use libc;
 use os;
@@ -130,7 +131,7 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<String
         let mut res = None;
         let mut done = false;
         while !done {
-            let mut buf = Vec::from_elem(n as uint, 0u16);
+            let mut buf: Vec<u16> = repeat(0u16).take(n).collect();
             let k = f(buf.as_mut_ptr(), n);
             if k == (0 as DWORD) {
                 done = true;
index 99292b3b44bd1749b3b84ca51e3d1c4d06fdd97c..a88d11eed22bd254645039b56629578c12489620 100644 (file)
@@ -34,6 +34,7 @@
 use libc::{get_osfhandle, CloseHandle};
 use libc::types::os::arch::extra::LPCVOID;
 use io::{mod, IoError, IoResult, MemReader};
+use iter::repeat;
 use prelude::*;
 use ptr;
 use str::from_utf8;
@@ -89,7 +90,7 @@ pub fn new(fd: c_int) -> IoResult<TTY> {
     pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
         // Read more if the buffer is empty
         if self.utf8.eof() {
-            let mut utf16 = Vec::from_elem(0x1000, 0u16);
+            let mut utf16: Vec<u16> = repeat(0u16).take(0x1000).collect();
             let mut num: DWORD = 0;
             match unsafe { ReadConsoleW(self.handle,
                                          utf16.as_mut_ptr() as LPVOID,
index 5a4f5731be50d9267c4ab672682f4f8cbc47b9ca..b5395d09ca7d4adb2b90a34fdae0bee7a1343615 100644 (file)
@@ -26,7 +26,7 @@
 use std::cell::RefCell;
 use std::fmt;
 use std::io::IoResult;
-use std::iter;
+use std::iter::{mod, repeat};
 use std::mem;
 use std::slice;
 
@@ -726,7 +726,7 @@ fn insert_entry(&mut self, id: NodeId, entry: MapEntry<'ast>) {
         debug!("ast_map: {} => {}", id, entry);
         let len = self.map.len();
         if id as uint >= len {
-            self.map.grow(id as uint - len + 1, NotPresent);
+            self.map.extend(repeat(NotPresent).take(id as uint - len + 1));
         }
         self.map[id as uint] = entry;
     }
index d2d624fa05e77be015f21786649b3295cda4def5..9fcaf2210c194ea74d726ccc855adca5a2eade3d 100644 (file)
@@ -470,7 +470,7 @@ pub fn expand_item(it: P<ast::Item>, fld: &mut MacroExpander)
 fn expand_item_modifiers(mut it: P<ast::Item>, fld: &mut MacroExpander)
                          -> P<ast::Item> {
     // partition the attributes into ItemModifiers and others
-    let (modifiers, other_attrs) = it.attrs.partitioned(|attr| {
+    let (modifiers, other_attrs): (Vec<_>, _) = it.attrs.iter().cloned().partition(|attr| {
         match fld.cx.syntax_env.find(&intern(attr.name().get())) {
             Some(rc) => match *rc { Modifier(_) => true, _ => false },
             _ => false
index 6474d92953fd115f569b8d6c7177e384fc6a0c88..500070a14d2d9f6b7281811c2ca31b2638ac38af 100644 (file)
@@ -22,6 +22,7 @@
 use ptr::P;
 
 use std::collections::HashMap;
+use std::iter::repeat;
 
 #[deriving(PartialEq)]
 enum ArgumentType {
@@ -477,7 +478,7 @@ fn static_array(ecx: &mut ExtCtxt,
     /// to
     fn into_expr(mut self) -> P<ast::Expr> {
         let mut locals = Vec::new();
-        let mut names = Vec::from_fn(self.name_positions.len(), |_| None);
+        let mut names: Vec<_> = repeat(None).take(self.name_positions.len()).collect();
         let mut pats = Vec::new();
         let mut heads = Vec::new();
 
@@ -664,7 +665,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
                                     name_ordering: Vec<String>,
                                     names: HashMap<String, P<ast::Expr>>)
                                     -> P<ast::Expr> {
-    let arg_types = Vec::from_fn(args.len(), |_| None);
+    let arg_types: Vec<_> = range(0, args.len()).map(|_| None).collect();
     let mut cx = Context {
         ecx: ecx,
         args: args,
@@ -707,13 +708,10 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, sp: Span,
             None => break
         }
     }
-    match parser.errors.remove(0) {
-        Some(error) => {
-            cx.ecx.span_err(cx.fmtsp,
-                            format!("invalid format string: {}", error)[]);
-            return DummyResult::raw_expr(sp);
-        }
-        None => {}
+    if !parser.errors.is_empty() {
+        cx.ecx.span_err(cx.fmtsp, format!("invalid format string: {}",
+                                          parser.errors.remove(0))[]);
+        return DummyResult::raw_expr(sp);
     }
     if !cx.literal.is_empty() {
         let s = cx.trans_literal_string();
index 73ef18b8449e0ee1f31641154e9eeb8d2f96c8aa..65ecf701e8dfcbd433041379ea3523138d8f4150 100644 (file)
@@ -166,7 +166,7 @@ pub fn count_names(ms: &[TokenTree]) -> uint {
 pub fn initial_matcher_pos(ms: Rc<Vec<TokenTree>>, sep: Option<Token>, lo: BytePos)
                            -> Box<MatcherPos> {
     let match_idx_hi = count_names(ms[]);
-    let matches = Vec::from_fn(match_idx_hi, |_i| Vec::new());
+    let matches: Vec<_> = range(0, match_idx_hi).map(|_| Vec::new()).collect();
     box MatcherPos {
         stack: vec![],
         top_elts: TtSeq(ms),
@@ -392,7 +392,8 @@ pub fn parse(sess: &ParseSess,
                             cur_eis.push(new_ei);
                         }
 
-                        let matches = Vec::from_elem(ei.matches.len(), Vec::new());
+                        let matches: Vec<_> = range(0, ei.matches.len())
+                            .map(|_| Vec::new()).collect();
                         let ei_t = ei;
                         cur_eis.push(box MatcherPos {
                             stack: vec![],
index ab0e0f9585c4ed7165ec540af6c785000ca1a7a4..a15f1ca354bffd8e870483e07dd7f288a18348f9 100644 (file)
@@ -65,6 +65,7 @@
 
 use std::io;
 use std::string;
+use std::iter::repeat;
 
 #[deriving(Clone, Copy, PartialEq)]
 pub enum Breaks {
@@ -166,9 +167,9 @@ pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: uint) -> Printer {
     // fall behind.
     let n: uint = 3 * linewidth;
     debug!("mk_printer {}", linewidth);
-    let token: Vec<Token> = Vec::from_elem(n, Eof);
-    let size: Vec<int> = Vec::from_elem(n, 0i);
-    let scan_stack: Vec<uint> = Vec::from_elem(n, 0u);
+    let token: Vec<Token> = repeat(Eof).take(n).collect();
+    let size: Vec<int> = repeat(0i).take(n).collect();
+    let scan_stack: Vec<uint> = repeat(0u).take(n).collect();
     Printer {
         out: out,
         buf_len: n,
index e1c8ff5011b267bc85db0d219eaf1be9cfec05b1..c1823231e24f75133f609268d2092d90273048b6 100644 (file)
@@ -163,7 +163,7 @@ fn fold_mod(&mut self, ast::Mod {inner, view_items, items}: ast::Mod) -> ast::Mo
                 }),
         };
 
-        let (crates, uses) = view_items.partitioned(|x| {
+        let (crates, uses): (Vec<_>, _) = view_items.iter().cloned().partition(|x| {
             match x.node {
                 ast::ViewItemExternCrate(..) => true,
                 _ => false,
index bac2452524e3eed4878a840e9518e1f36e0286a2..680ed55cd98438db54a196aec96a8f14311b8a4a 100644 (file)
@@ -16,6 +16,7 @@
 use self::FormatOp::*;
 use std::ascii::OwnedAsciiExt;
 use std::mem::replace;
+use std::iter::repeat;
 
 #[deriving(Copy, PartialEq)]
 enum States {
@@ -508,7 +509,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
             if flags.precision > s.len() {
                 let mut s_ = Vec::with_capacity(flags.precision);
                 let n = flags.precision - s.len();
-                s_.grow(n, b'0');
+                s_.extend(repeat(b'0').take(n));
                 s_.extend(s.into_iter());
                 s = s_;
             }
@@ -560,10 +561,10 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result<Vec<u8> ,String> {
     if flags.width > s.len() {
         let n = flags.width - s.len();
         if flags.left {
-            s.grow(n, b' ');
+            s.extend(repeat(b' ').take(n));
         } else {
             let mut s_ = Vec::with_capacity(flags.width);
-            s_.grow(n, b' ');
+            s_.extend(repeat(b' ').take(n));
             s_.extend(s.into_iter());
             s = s_;
         }
index 88dd6fce88f044337fcccb147db68127240b0e88..c097e9337905093b510f1d1c6f0c30519c641fe9 100644 (file)
@@ -990,8 +990,8 @@ fn run_tests<F>(opts: &TestOpts,
 
     try!(callback(TeFiltered(filtered_descs)));
 
-    let (filtered_tests, filtered_benchs_and_metrics) =
-        filtered_tests.partition(|e| {
+    let (filtered_tests, filtered_benchs_and_metrics): (Vec<_>, _) =
+        filtered_tests.into_iter().partition(|e| {
             match e.testfn {
                 StaticTestFn(_) | DynTestFn(_) => true,
                 _ => false
index d239cb8289682bc80eeddcc65a10d77615054e23..9e4aa0712470bc6c7ebe346d0fb62f119927b7f8 100644 (file)
 use core::cmp::Ordering::{Equal, Less, Greater};
 use core::option::Option;
 use core::option::Option::{Some, None};
-use core::slice;
 use core::slice::SliceExt;
+use core::result::Result::{Ok, Err};
 use tables::normalization::{canonical_table, compatibility_table, composition_table};
 
 fn bsearch_table<T>(c: char, r: &'static [(char, &'static [T])]) -> Option<&'static [T]> {
-    match r.binary_search(|&(val, _)| {
+    match r.binary_search_by(|&(val, _)| {
         if c == val { Equal }
         else if val < c { Less }
         else { Greater }
     }) {
-        slice::BinarySearchResult::Found(idx) => {
+        Ok(idx) => {
             let (_, result) = r[idx];
             Some(result)
         }
-        slice::BinarySearchResult::NotFound(_) => None
+        Err(_) => None
     }
 }
 
@@ -81,16 +81,16 @@ pub fn compose(a: char, b: char) -> Option<char> {
         match bsearch_table(a, composition_table) {
             None => None,
             Some(candidates) => {
-                match candidates.binary_search(|&(val, _)| {
+                match candidates.binary_search_by(|&(val, _)| {
                     if b == val { Equal }
                     else if val < b { Less }
                     else { Greater }
                 }) {
-                    slice::BinarySearchResult::Found(idx) => {
+                    Ok(idx) => {
                         let (_, result) = candidates[idx];
                         Some(result)
                     }
-                    slice::BinarySearchResult::NotFound(_) => None
+                    Err(_) => None
                 }
             }
         }
index a219aefad192c81b84fc556d40c8fffa15874ede..5a8f63f207e2721be96a15bfcadf8b83c453c5a3 100644 (file)
 fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
     use core::cmp::Ordering::{Equal, Less, Greater};
     use core::slice::SliceExt;
-    r.binary_search(|&(lo,hi)| {
+    r.binary_search_by(|&(lo,hi)| {
         if lo <= c && c <= hi { Equal }
         else if hi < c { Less }
         else { Greater }
-    }).found().is_some()
+    }).is_ok()
 }
 
 pub mod general_category {
@@ -6826,17 +6826,17 @@ pub mod normalization {
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, u8)]) -> u8 {
         use core::cmp::Ordering::{Equal, Less, Greater};
         use core::slice::SliceExt;
-        use core::slice;
-        match r.binary_search(|&(lo, hi, _)| {
+        use core::result::Result::{Ok, Err};
+        match r.binary_search_by(|&(lo, hi, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, result) = r[idx];
                 result
             }
-            slice::BinarySearchResult::NotFound(_) => 0
+            Err(_) => 0
         }
     }
 
@@ -6961,7 +6961,7 @@ pub mod conversions {
     use core::slice::SliceExt;
     use core::option::Option;
     use core::option::Option::{Some, None};
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     pub fn to_lower(c: char) -> char {
         match bsearch_case_table(c, LuLl_table) {
@@ -6978,13 +6978,13 @@ pub fn to_upper(c: char) -> char {
     }
 
     fn bsearch_case_table(c: char, table: &'static [(char, char)]) -> Option<uint> {
-        match table.binary_search(|&(key, _)| {
+        match table.binary_search_by(|&(key, _)| {
             if c == key { Equal }
             else if key < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(i) => Some(i),
-            slice::BinarySearchResult::NotFound(_) => None,
+            Ok(i) => Some(i),
+            Err(_) => None,
         }
     }
 
@@ -7596,20 +7596,20 @@ pub mod charwidth {
     use core::option::Option;
     use core::option::Option::{Some, None};
     use core::slice::SliceExt;
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     fn bsearch_range_value_table(c: char, is_cjk: bool, r: &'static [(char, char, u8, u8)]) -> u8 {
         use core::cmp::Ordering::{Equal, Less, Greater};
-        match r.binary_search(|&(lo, hi, _, _)| {
+        match r.binary_search_by(|&(lo, hi, _, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, r_ncjk, r_cjk) = r[idx];
                 if is_cjk { r_cjk } else { r_ncjk }
             }
-            slice::BinarySearchResult::NotFound(_) => 1
+            Err(_) => 1
         }
     }
 
@@ -7804,7 +7804,7 @@ pub mod grapheme {
     use core::kinds::Copy;
     use core::slice::SliceExt;
     pub use self::GraphemeCat::*;
-    use core::slice;
+    use core::result::Result::{Ok, Err};
 
     #[allow(non_camel_case_types)]
     #[deriving(Clone)]
@@ -7825,16 +7825,16 @@ impl Copy for GraphemeCat {}
 
     fn bsearch_range_value_table(c: char, r: &'static [(char, char, GraphemeCat)]) -> GraphemeCat {
         use core::cmp::Ordering::{Equal, Less, Greater};
-        match r.binary_search(|&(lo, hi, _)| {
+        match r.binary_search_by(|&(lo, hi, _)| {
             if lo <= c && c <= hi { Equal }
             else if hi < c { Less }
             else { Greater }
         }) {
-            slice::BinarySearchResult::Found(idx) => {
+            Ok(idx) => {
                 let (_, _, cat) = r[idx];
                 cat
             }
-            slice::BinarySearchResult::NotFound(_) => GC_Any
+            Err(_) => GC_Any
         }
     }
 
index aed73472416064642911af790b25d57c9390b6c7..3a37981744a5af2433fed551f742465c78c9af7f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit aed73472416064642911af790b25d57c9390b6c7
+Subproject commit 3a37981744a5af2433fed551f742465c78c9af7f
index d9a4aede7d7d910b5f0c703ee07b8bb6ea962351..26d4ec25c643955f3641f0a38aaf4b81c60f62d7 100644 (file)
@@ -65,7 +65,7 @@ fn shift_push() {
     let mut v2 = Vec::new();
 
     while v1.len() > 0 {
-        v2.push(v1.remove(0).unwrap());
+        v2.push(v1.remove(0));
     }
 }
 
index 6ee2233f1686223306930f1f438e65725dab1273..909f8afc34a9fe68f5dd1fa1c92a1f7bbc4aebca 100644 (file)
@@ -181,7 +181,7 @@ fn reverse_complement(seq: &mut [u8], tables: &Tables) {
         unsafe {
             copy_memory(seq.as_mut_ptr().offset((i - off + 1) as int),
                         seq.as_ptr().offset((i - off) as int), off);
-            *seq.unsafe_mut(i - off) = b'\n';
+            *seq.get_unchecked_mut(i - off) = b'\n';
         }
         i += LINE_LEN + 1;
     }
index df19de7731a9e865bca6c9625bc1f9d54abfdbf4..5be3b960ec635711d09cdff1ecb2623836257376 100644 (file)
@@ -9,9 +9,9 @@
 // except according to those terms.
 
 use std::slice::Chunks;
-use std::slice::MutChunks;
+use std::slice::ChunksMut;
 
-fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: MutChunks<'a,T>)
+fn dft_iter<'a, T>(arg1: Chunks<'a,T>, arg2: ChunksMut<'a,T>)
 {
     for
     &something
index de934286a7cba65010cb1500694953750dd42d74..45b0314d2c01da88190a844571b87fecb337bb44 100644 (file)
@@ -15,4 +15,3 @@
 
 fn main() {
 }
-