Fallout from renaming
This commit is contained in:
parent
d8dfe1957b
commit
fc525eeb4e
@ -259,7 +259,7 @@ pub fn run_tests(config: &Config) {
|
||||
// parallel (especially when we have lots and lots of child processes).
|
||||
// For context, see #8904
|
||||
io::test::raise_fd_limit();
|
||||
let res = test::run_tests_console(&opts, tests.move_iter().collect());
|
||||
let res = test::run_tests_console(&opts, tests.into_iter().collect());
|
||||
match res {
|
||||
Ok(true) => {}
|
||||
Ok(false) => fail!("Some tests failed"),
|
||||
@ -400,4 +400,4 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
|
||||
},
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ pub fn run(lib_path: &str,
|
||||
let mut cmd = Command::new(prog);
|
||||
cmd.args(args);
|
||||
add_target_env(&mut cmd, lib_path, aux_path);
|
||||
for (key, val) in env.move_iter() {
|
||||
for (key, val) in env.into_iter() {
|
||||
cmd.env(key, val);
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ pub fn run_background(lib_path: &str,
|
||||
let mut cmd = Command::new(prog);
|
||||
cmd.args(args);
|
||||
add_target_env(&mut cmd, lib_path, aux_path);
|
||||
for (key, val) in env.move_iter() {
|
||||
for (key, val) in env.into_iter() {
|
||||
cmd.env(key, val);
|
||||
}
|
||||
|
||||
|
@ -768,7 +768,7 @@ fn cleanup_debug_info_options(options: &Option<String>) -> Option<String> {
|
||||
"--debuginfo".to_string()
|
||||
];
|
||||
let new_options =
|
||||
split_maybe_args(options).move_iter()
|
||||
split_maybe_args(options).into_iter()
|
||||
.filter(|x| !options_to_remove.contains(x))
|
||||
.collect::<Vec<String>>()
|
||||
.connect(" ");
|
||||
@ -1461,7 +1461,7 @@ fn _arm_exec_compiled_test(config: &Config,
|
||||
|
||||
// run test via adb_run_wrapper
|
||||
runargs.push("shell".to_string());
|
||||
for (key, val) in env.move_iter() {
|
||||
for (key, val) in env.into_iter() {
|
||||
runargs.push(format!("{}={}", key, val));
|
||||
}
|
||||
runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir));
|
||||
|
@ -238,7 +238,7 @@ fn main() {
|
||||
let mut futures = Vec::from_fn(1000, |ind| Future::spawn( proc() { partial_sum(ind) }));
|
||||
|
||||
let mut final_res = 0f64;
|
||||
for ft in futures.mut_iter() {
|
||||
for ft in futures.iter_mut() {
|
||||
final_res += ft.get();
|
||||
}
|
||||
println!("π^2/6 is not far from : {}", final_res);
|
||||
|
@ -1319,7 +1319,7 @@ upper bound is exclusive, though, so our loop will print `0` through `9`, not
|
||||
|
||||
Rust does not have the "C style" `for` loop on purpose. Manually controlling
|
||||
each element of the loop is complicated and error prone, even for experienced C
|
||||
developers.
|
||||
developers.
|
||||
|
||||
We'll talk more about `for` when we cover **iterator**s, later in the Guide.
|
||||
|
||||
|
@ -140,7 +140,7 @@ static MIN_ALIGN: uint = 16;
|
||||
#[cfg(jemalloc)]
|
||||
mod imp {
|
||||
use core::option::{None, Option};
|
||||
use core::ptr::{RawPtr, mut_null, null};
|
||||
use core::ptr::{RawPtr, null_mut, null};
|
||||
use core::num::Int;
|
||||
use libc::{c_char, c_int, c_void, size_t};
|
||||
use super::MIN_ALIGN;
|
||||
@ -230,7 +230,7 @@ mod imp {
|
||||
|
||||
pub fn stats_print() {
|
||||
unsafe {
|
||||
je_malloc_stats_print(None, mut_null(), null())
|
||||
je_malloc_stats_print(None, null_mut(), null())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
//! The global (exchange) heap.
|
||||
|
||||
use libc::{c_void, size_t, free, malloc, realloc};
|
||||
use core::ptr::{RawPtr, mut_null};
|
||||
use core::ptr::{RawPtr, null_mut};
|
||||
|
||||
/// A wrapper around libc::malloc, aborting on out-of-memory.
|
||||
#[inline]
|
||||
@ -20,7 +20,7 @@ pub unsafe fn malloc_raw(size: uint) -> *mut u8 {
|
||||
// `malloc(0)` may allocate, but it may also return a null pointer
|
||||
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html
|
||||
if size == 0 {
|
||||
mut_null()
|
||||
null_mut()
|
||||
} else {
|
||||
let p = malloc(size as size_t);
|
||||
if p.is_null() {
|
||||
@ -37,7 +37,7 @@ pub unsafe fn realloc_raw(ptr: *mut u8, size: uint) -> *mut u8 {
|
||||
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/realloc.html
|
||||
if size == 0 {
|
||||
free(ptr as *mut c_void);
|
||||
mut_null()
|
||||
null_mut()
|
||||
} else {
|
||||
let p = realloc(ptr as *mut c_void, size as size_t);
|
||||
if p.is_null() {
|
||||
|
@ -448,7 +448,7 @@ impl<T> TypedArena<T> {
|
||||
#[inline]
|
||||
pub fn with_capacity(capacity: uint) -> TypedArena<T> {
|
||||
unsafe {
|
||||
let chunk = TypedArenaChunk::<T>::new(ptr::mut_null(), capacity);
|
||||
let chunk = TypedArenaChunk::<T>::new(ptr::null_mut(), capacity);
|
||||
TypedArena {
|
||||
ptr: Cell::new((*chunk).start() as *const T),
|
||||
end: Cell::new((*chunk).end() as *const T),
|
||||
|
@ -178,7 +178,7 @@ impl Bitv {
|
||||
// `op` is a bitwise operation, since any bits that should've
|
||||
// been masked were fine to change anyway. `b` is masked to
|
||||
// make sure its unmasked bits do not cause damage.
|
||||
for (a, (_, b)) in self.storage.mut_iter()
|
||||
for (a, (_, b)) in self.storage.iter_mut()
|
||||
.zip(other.mask_words(0)) {
|
||||
let w = op(*a, b);
|
||||
if *a != w {
|
||||
@ -310,7 +310,7 @@ impl Bitv {
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn set_all(&mut self) {
|
||||
for w in self.storage.mut_iter() { *w = !0u; }
|
||||
for w in self.storage.iter_mut() { *w = !0u; }
|
||||
}
|
||||
|
||||
/// Flips all bits.
|
||||
@ -329,7 +329,7 @@ impl Bitv {
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn negate(&mut self) {
|
||||
for w in self.storage.mut_iter() { *w = !*w; }
|
||||
for w in self.storage.iter_mut() { *w = !*w; }
|
||||
}
|
||||
|
||||
/// Calculates the union of two bitvectors. This acts like the bitwise `or`
|
||||
@ -797,7 +797,7 @@ impl Collection for Bitv {
|
||||
impl Mutable for Bitv {
|
||||
#[inline]
|
||||
fn clear(&mut self) {
|
||||
for w in self.storage.mut_iter() { *w = 0u; }
|
||||
for w in self.storage.iter_mut() { *w = 0u; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ impl Clone for Bitv {
|
||||
fn clone_from(&mut self, source: &Bitv) {
|
||||
self.nbits = source.nbits;
|
||||
self.storage.reserve(source.storage.len());
|
||||
for (i, w) in self.storage.mut_iter().enumerate() { *w = source.storage[i]; }
|
||||
for (i, w) in self.storage.iter_mut().enumerate() { *w = source.storage[i]; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ pub struct MoveItems<T> {
|
||||
impl<T> Rawlink<T> {
|
||||
/// Like Option::None for Rawlink
|
||||
fn none() -> Rawlink<T> {
|
||||
Rawlink{p: ptr::mut_null()}
|
||||
Rawlink{p: ptr::null_mut()}
|
||||
}
|
||||
|
||||
/// Like Option::Some for Rawlink
|
||||
@ -431,7 +431,7 @@ impl<T> DList<T> {
|
||||
/// ```
|
||||
pub fn insert_when(&mut self, elt: T, f: |&T, &T| -> bool) {
|
||||
{
|
||||
let mut it = self.mut_iter();
|
||||
let mut it = self.iter_mut();
|
||||
loop {
|
||||
match it.peek_next() {
|
||||
None => break,
|
||||
@ -451,7 +451,7 @@ impl<T> DList<T> {
|
||||
/// This operation should compute in O(max(N, M)) time.
|
||||
pub fn merge(&mut self, mut other: DList<T>, f: |&T, &T| -> bool) {
|
||||
{
|
||||
let mut it = self.mut_iter();
|
||||
let mut it = self.iter_mut();
|
||||
loop {
|
||||
let take_a = match (it.peek_next(), other.front()) {
|
||||
(_ , None) => return,
|
||||
@ -871,7 +871,7 @@ mod tests {
|
||||
check_links(&m);
|
||||
let sum = v.append(u.as_slice());
|
||||
assert_eq!(sum.len(), m.len());
|
||||
for elt in sum.move_iter() {
|
||||
for elt in sum.into_iter() {
|
||||
assert_eq!(m.pop_front(), Some(elt))
|
||||
}
|
||||
}
|
||||
@ -895,7 +895,7 @@ mod tests {
|
||||
check_links(&m);
|
||||
let sum = u.append(v.as_slice());
|
||||
assert_eq!(sum.len(), m.len());
|
||||
for elt in sum.move_iter() {
|
||||
for elt in sum.into_iter() {
|
||||
assert_eq!(m.pop_front(), Some(elt))
|
||||
}
|
||||
}
|
||||
@ -920,7 +920,7 @@ mod tests {
|
||||
m.rotate_backward(); check_links(&m);
|
||||
m.push_front(9); check_links(&m);
|
||||
m.rotate_forward(); check_links(&m);
|
||||
assert_eq!(vec![3i,9,5,1,2], m.move_iter().collect());
|
||||
assert_eq!(vec![3i,9,5,1,2], m.into_iter().collect());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -991,16 +991,16 @@ mod tests {
|
||||
fn test_mut_iter() {
|
||||
let mut m = generate_test();
|
||||
let mut len = m.len();
|
||||
for (i, elt) in m.mut_iter().enumerate() {
|
||||
for (i, elt) in m.iter_mut().enumerate() {
|
||||
assert_eq!(i as int, *elt);
|
||||
len -= 1;
|
||||
}
|
||||
assert_eq!(len, 0);
|
||||
let mut n = DList::new();
|
||||
assert!(n.mut_iter().next().is_none());
|
||||
assert!(n.iter_mut().next().is_none());
|
||||
n.push_front(4i);
|
||||
n.push(5);
|
||||
let mut it = n.mut_iter();
|
||||
let mut it = n.iter_mut();
|
||||
assert_eq!(it.size_hint(), (2, Some(2)));
|
||||
assert!(it.next().is_some());
|
||||
assert!(it.next().is_some());
|
||||
@ -1011,11 +1011,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_iterator_mut_double_end() {
|
||||
let mut n = DList::new();
|
||||
assert!(n.mut_iter().next_back().is_none());
|
||||
assert!(n.iter_mut().next_back().is_none());
|
||||
n.push_front(4i);
|
||||
n.push_front(5);
|
||||
n.push_front(6);
|
||||
let mut it = n.mut_iter();
|
||||
let mut it = n.iter_mut();
|
||||
assert_eq!(it.size_hint(), (3, Some(3)));
|
||||
assert_eq!(*it.next().unwrap(), 6);
|
||||
assert_eq!(it.size_hint(), (2, Some(2)));
|
||||
@ -1031,7 +1031,7 @@ mod tests {
|
||||
let mut m = list_from(&[0i,2,4,6,8]);
|
||||
let len = m.len();
|
||||
{
|
||||
let mut it = m.mut_iter();
|
||||
let mut it = m.iter_mut();
|
||||
it.insert_next(-2);
|
||||
loop {
|
||||
match it.next() {
|
||||
@ -1050,7 +1050,7 @@ mod tests {
|
||||
}
|
||||
check_links(&m);
|
||||
assert_eq!(m.len(), 3 + len * 2);
|
||||
assert_eq!(m.move_iter().collect::<Vec<int>>(), vec![-2,0,1,2,3,4,5,6,7,8,9,0,1]);
|
||||
assert_eq!(m.into_iter().collect::<Vec<int>>(), vec![-2,0,1,2,3,4,5,6,7,8,9,0,1]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1061,7 +1061,7 @@ mod tests {
|
||||
m.merge(n, |a, b| a <= b);
|
||||
assert_eq!(m.len(), len);
|
||||
check_links(&m);
|
||||
let res = m.move_iter().collect::<Vec<int>>();
|
||||
let res = m.into_iter().collect::<Vec<int>>();
|
||||
assert_eq!(res, vec![-1, 0, 0, 0, 1, 3, 5, 6, 7, 2, 7, 7, 9]);
|
||||
}
|
||||
|
||||
@ -1077,19 +1077,19 @@ mod tests {
|
||||
m.push(4);
|
||||
m.insert_ordered(3);
|
||||
check_links(&m);
|
||||
assert_eq!(vec![2,3,4], m.move_iter().collect::<Vec<int>>());
|
||||
assert_eq!(vec![2,3,4], m.into_iter().collect::<Vec<int>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mut_rev_iter() {
|
||||
let mut m = generate_test();
|
||||
for (i, elt) in m.mut_iter().rev().enumerate() {
|
||||
for (i, elt) in m.iter_mut().rev().enumerate() {
|
||||
assert_eq!((6-i) as int, *elt);
|
||||
}
|
||||
let mut n = DList::new();
|
||||
assert!(n.mut_iter().rev().next().is_none());
|
||||
assert!(n.iter_mut().rev().next().is_none());
|
||||
n.push_front(4i);
|
||||
let mut it = n.mut_iter().rev();
|
||||
let mut it = n.iter_mut().rev();
|
||||
assert!(it.next().is_some());
|
||||
assert!(it.next().is_none());
|
||||
}
|
||||
@ -1229,7 +1229,7 @@ mod tests {
|
||||
check_links(&m);
|
||||
|
||||
let mut i = 0u;
|
||||
for (a, &b) in m.move_iter().zip(v.iter()) {
|
||||
for (a, &b) in m.into_iter().zip(v.iter()) {
|
||||
i += 1;
|
||||
assert_eq!(a, b);
|
||||
}
|
||||
@ -1311,7 +1311,7 @@ mod tests {
|
||||
let v = &[0i, ..128];
|
||||
let mut m: DList<int> = v.iter().map(|&x|x).collect();
|
||||
b.iter(|| {
|
||||
assert!(m.mut_iter().count() == 128);
|
||||
assert!(m.iter_mut().count() == 128);
|
||||
})
|
||||
}
|
||||
#[bench]
|
||||
@ -1327,7 +1327,7 @@ mod tests {
|
||||
let v = &[0i, ..128];
|
||||
let mut m: DList<int> = v.iter().map(|&x|x).collect();
|
||||
b.iter(|| {
|
||||
assert!(m.mut_iter().rev().count() == 128);
|
||||
assert!(m.iter_mut().rev().count() == 128);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ impl<T> Collection for RingBuf<T> {
|
||||
impl<T> Mutable for RingBuf<T> {
|
||||
/// Clears the `RingBuf`, removing all values.
|
||||
fn clear(&mut self) {
|
||||
for x in self.elts.mut_iter() { *x = None }
|
||||
for x in self.elts.iter_mut() { *x = None }
|
||||
self.nelts = 0;
|
||||
self.lo = 0;
|
||||
}
|
||||
@ -267,11 +267,11 @@ impl<T> RingBuf<T> {
|
||||
/// buf.push(5i);
|
||||
/// buf.push(3);
|
||||
/// buf.push(4);
|
||||
/// for num in buf.mut_iter() {
|
||||
/// for num in buf.iter_mut() {
|
||||
/// *num = *num - 2;
|
||||
/// }
|
||||
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
|
||||
/// assert_eq!(buf.mut_iter().collect::<Vec<&mut int>>().as_slice(), b);
|
||||
/// assert_eq!(buf.iter_mut().collect::<Vec<&mut int>>().as_slice(), b);
|
||||
/// ```
|
||||
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
|
||||
let start_index = raw_index(self.lo, self.elts.len(), 0);
|
||||
@ -283,15 +283,15 @@ impl<T> RingBuf<T> {
|
||||
// start_index to self.elts.len()
|
||||
// and then
|
||||
// 0 to end_index
|
||||
let (temp, remaining1) = self.elts.mut_split_at(start_index);
|
||||
let (remaining2, _) = temp.mut_split_at(end_index);
|
||||
let (temp, remaining1) = self.elts.split_at_mut(start_index);
|
||||
let (remaining2, _) = temp.split_at_mut(end_index);
|
||||
MutItems { remaining1: remaining1,
|
||||
remaining2: remaining2,
|
||||
nelts: self.nelts }
|
||||
} else {
|
||||
// Items to iterate goes from start_index to end_index:
|
||||
let (empty, elts) = self.elts.mut_split_at(0);
|
||||
let remaining1 = elts.mut_slice(start_index, end_index);
|
||||
let (empty, elts) = self.elts.split_at_mut(0);
|
||||
let remaining1 = elts.slice_mut(start_index, end_index);
|
||||
MutItems { remaining1: remaining1,
|
||||
remaining2: empty,
|
||||
nelts: self.nelts }
|
||||
@ -919,7 +919,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_rev_iter_wrap() {
|
||||
let mut d = RingBuf::with_capacity(3);
|
||||
assert!(d.mut_iter().rev().next().is_none());
|
||||
assert!(d.iter_mut().rev().next().is_none());
|
||||
|
||||
d.push(1i);
|
||||
d.push(2);
|
||||
@ -927,26 +927,26 @@ mod tests {
|
||||
assert_eq!(d.pop_front(), Some(1));
|
||||
d.push(4);
|
||||
|
||||
assert_eq!(d.mut_iter().rev().map(|x| *x).collect::<Vec<int>>(),
|
||||
assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<int>>(),
|
||||
vec!(4, 3, 2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_mut_iter() {
|
||||
let mut d = RingBuf::new();
|
||||
assert!(d.mut_iter().next().is_none());
|
||||
assert!(d.iter_mut().next().is_none());
|
||||
|
||||
for i in range(0u, 3) {
|
||||
d.push_front(i);
|
||||
}
|
||||
|
||||
for (i, elt) in d.mut_iter().enumerate() {
|
||||
for (i, elt) in d.iter_mut().enumerate() {
|
||||
assert_eq!(*elt, 2 - i);
|
||||
*elt = i;
|
||||
}
|
||||
|
||||
{
|
||||
let mut it = d.mut_iter();
|
||||
let mut it = d.iter_mut();
|
||||
assert_eq!(*it.next().unwrap(), 0);
|
||||
assert_eq!(*it.next().unwrap(), 1);
|
||||
assert_eq!(*it.next().unwrap(), 2);
|
||||
@ -957,19 +957,19 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_rev_iter() {
|
||||
let mut d = RingBuf::new();
|
||||
assert!(d.mut_iter().rev().next().is_none());
|
||||
assert!(d.iter_mut().rev().next().is_none());
|
||||
|
||||
for i in range(0u, 3) {
|
||||
d.push_front(i);
|
||||
}
|
||||
|
||||
for (i, elt) in d.mut_iter().rev().enumerate() {
|
||||
for (i, elt) in d.iter_mut().rev().enumerate() {
|
||||
assert_eq!(*elt, i);
|
||||
*elt = i;
|
||||
}
|
||||
|
||||
{
|
||||
let mut it = d.mut_iter().rev();
|
||||
let mut it = d.iter_mut().rev();
|
||||
assert_eq!(*it.next().unwrap(), 0);
|
||||
assert_eq!(*it.next().unwrap(), 1);
|
||||
assert_eq!(*it.next().unwrap(), 2);
|
||||
|
@ -77,7 +77,7 @@
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! * `.mut_iter()` returns an iterator that allows modifying each value.
|
||||
//! * `.iter_mut()` returns an iterator that allows modifying each value.
|
||||
//! * Further iterators exist that split, chunk or permute the slice.
|
||||
|
||||
#![doc(primitive = "slice")]
|
||||
@ -195,7 +195,7 @@ impl Iterator<(uint, uint)> for ElementSwaps {
|
||||
self.sdir.as_mut_slice().swap(i, j);
|
||||
|
||||
// Swap the direction of each larger SizeDirection
|
||||
for x in self.sdir.mut_iter() {
|
||||
for x in self.sdir.iter_mut() {
|
||||
if x.size > sd.size {
|
||||
x.dir = match x.dir { Pos => Neg, Neg => Pos };
|
||||
}
|
||||
@ -606,7 +606,7 @@ impl<'a,T> MutableSliceAllocating<'a, T> for &'a mut [T] {
|
||||
|
||||
#[inline]
|
||||
fn move_from(self, mut src: Vec<T>, start: uint, end: uint) -> uint {
|
||||
for (a, b) in self.mut_iter().zip(src.mut_slice(start, end).mut_iter()) {
|
||||
for (a, b) in self.iter_mut().zip(src.slice_mut(start, end).iter_mut()) {
|
||||
mem::swap(a, b);
|
||||
}
|
||||
cmp::min(self.len(), end-start)
|
||||
@ -698,7 +698,7 @@ impl<'a, T: Ord> MutableOrdSlice<T> for &'a mut [T] {
|
||||
self.swap(j, i-1);
|
||||
|
||||
// Step 4: Reverse the (previously) weakly decreasing part
|
||||
self.mut_slice_from(i).reverse();
|
||||
self.slice_from_mut(i).reverse();
|
||||
|
||||
true
|
||||
}
|
||||
@ -719,7 +719,7 @@ impl<'a, T: Ord> MutableOrdSlice<T> for &'a mut [T] {
|
||||
}
|
||||
|
||||
// Step 2: Reverse the weakly increasing part
|
||||
self.mut_slice_from(i).reverse();
|
||||
self.slice_from_mut(i).reverse();
|
||||
|
||||
// Step 3: Find the rightmost element equal to or bigger than the pivot (i-1)
|
||||
let mut j = self.len() - 1;
|
||||
@ -1685,7 +1685,7 @@ mod tests {
|
||||
fn test_iter_size_hints() {
|
||||
let mut xs = [1i, 2, 5, 10, 11];
|
||||
assert_eq!(xs.iter().size_hint(), (5, Some(5)));
|
||||
assert_eq!(xs.mut_iter().size_hint(), (5, Some(5)));
|
||||
assert_eq!(xs.iter_mut().size_hint(), (5, Some(5)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1702,7 +1702,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_iterator() {
|
||||
let mut xs = [1i, 2, 3, 4, 5];
|
||||
for x in xs.mut_iter() {
|
||||
for x in xs.iter_mut() {
|
||||
*x += 1;
|
||||
}
|
||||
assert!(xs == [2, 3, 4, 5, 6])
|
||||
@ -1724,7 +1724,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_rev_iterator() {
|
||||
let mut xs = [1u, 2, 3, 4, 5];
|
||||
for (i,x) in xs.mut_iter().rev().enumerate() {
|
||||
for (i,x) in xs.iter_mut().rev().enumerate() {
|
||||
*x += i;
|
||||
}
|
||||
assert!(xs == [5, 5, 5, 5, 5])
|
||||
@ -1733,13 +1733,13 @@ mod tests {
|
||||
#[test]
|
||||
fn test_move_iterator() {
|
||||
let xs = vec![1u,2,3,4,5];
|
||||
assert_eq!(xs.move_iter().fold(0, |a: uint, b: uint| 10*a + b), 12345);
|
||||
assert_eq!(xs.into_iter().fold(0, |a: uint, b: uint| 10*a + b), 12345);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_move_rev_iterator() {
|
||||
let xs = vec![1u,2,3,4,5];
|
||||
assert_eq!(xs.move_iter().rev().fold(0, |a: uint, b: uint| 10*a + b), 54321);
|
||||
assert_eq!(xs.into_iter().rev().fold(0, |a: uint, b: uint| 10*a + b), 54321);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -1892,7 +1892,7 @@ mod tests {
|
||||
assert!(a == [7i,2,3,4]);
|
||||
let mut a = [1i,2,3,4,5];
|
||||
let b = vec![5i,6,7,8,9,0];
|
||||
assert_eq!(a.mut_slice(2,4).move_from(b,1,6), 2);
|
||||
assert_eq!(a.slice_mut(2,4).move_from(b,1,6), 2);
|
||||
assert!(a == [1i,2,6,7,5]);
|
||||
}
|
||||
|
||||
@ -1911,7 +1911,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_reverse_part() {
|
||||
let mut values = [1i,2,3,4,5];
|
||||
values.mut_slice(1, 4).reverse();
|
||||
values.slice_mut(1, 4).reverse();
|
||||
assert!(values == [1,4,3,2,5]);
|
||||
}
|
||||
|
||||
@ -1958,9 +1958,9 @@ mod tests {
|
||||
fn test_bytes_set_memory() {
|
||||
use slice::bytes::MutableByteVector;
|
||||
let mut values = [1u8,2,3,4,5];
|
||||
values.mut_slice(0,5).set_memory(0xAB);
|
||||
values.slice_mut(0,5).set_memory(0xAB);
|
||||
assert!(values == [0xAB, 0xAB, 0xAB, 0xAB, 0xAB]);
|
||||
values.mut_slice(2,4).set_memory(0xFF);
|
||||
values.slice_mut(2,4).set_memory(0xFF);
|
||||
assert!(values == [0xAB, 0xAB, 0xFF, 0xFF, 0xAB]);
|
||||
}
|
||||
|
||||
@ -1985,14 +1985,14 @@ mod tests {
|
||||
fn test_mut_split_at() {
|
||||
let mut values = [1u8,2,3,4,5];
|
||||
{
|
||||
let (left, right) = values.mut_split_at(2);
|
||||
let (left, right) = values.split_at_mut(2);
|
||||
assert!(left.slice(0, left.len()) == [1, 2]);
|
||||
for p in left.mut_iter() {
|
||||
for p in left.iter_mut() {
|
||||
*p += 1;
|
||||
}
|
||||
|
||||
assert!(right.slice(0, right.len()) == [3, 4, 5]);
|
||||
for p in right.mut_iter() {
|
||||
for p in right.iter_mut() {
|
||||
*p += 2;
|
||||
}
|
||||
}
|
||||
@ -2021,13 +2021,13 @@ mod tests {
|
||||
}
|
||||
assert_eq!(cnt, 5);
|
||||
|
||||
for f in v.mut_iter() {
|
||||
for f in v.iter_mut() {
|
||||
assert!(*f == Foo);
|
||||
cnt += 1;
|
||||
}
|
||||
assert_eq!(cnt, 8);
|
||||
|
||||
for f in v.move_iter() {
|
||||
for f in v.into_iter() {
|
||||
assert!(f == Foo);
|
||||
cnt += 1;
|
||||
}
|
||||
@ -2113,14 +2113,14 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_splitator() {
|
||||
let mut xs = [0i,1,0,2,3,0,0,4,5,0];
|
||||
assert_eq!(xs.mut_split(|x| *x == 0).count(), 6);
|
||||
for slice in xs.mut_split(|x| *x == 0) {
|
||||
assert_eq!(xs.split_mut(|x| *x == 0).count(), 6);
|
||||
for slice in xs.split_mut(|x| *x == 0) {
|
||||
slice.reverse();
|
||||
}
|
||||
assert!(xs == [0,1,0,3,2,0,0,5,4,0]);
|
||||
|
||||
let mut xs = [0i,1,0,2,3,0,0,4,5,0,6,7];
|
||||
for slice in xs.mut_split(|x| *x == 0).take(5) {
|
||||
for slice in xs.split_mut(|x| *x == 0).take(5) {
|
||||
slice.reverse();
|
||||
}
|
||||
assert!(xs == [0,1,0,3,2,0,0,5,4,0,6,7]);
|
||||
@ -2129,7 +2129,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_splitator_rev() {
|
||||
let mut xs = [1i,2,0,3,4,0,0,5,6,0];
|
||||
for slice in xs.mut_split(|x| *x == 0).rev().take(4) {
|
||||
for slice in xs.split_mut(|x| *x == 0).rev().take(4) {
|
||||
slice.reverse();
|
||||
}
|
||||
assert!(xs == [1,2,0,4,3,0,0,6,5,0]);
|
||||
@ -2148,8 +2148,8 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_chunks() {
|
||||
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
|
||||
for (i, chunk) in v.mut_chunks(3).enumerate() {
|
||||
for x in chunk.mut_iter() {
|
||||
for (i, chunk) in v.chunks_mut(3).enumerate() {
|
||||
for x in chunk.iter_mut() {
|
||||
*x = i as u8;
|
||||
}
|
||||
}
|
||||
@ -2160,8 +2160,8 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_chunks_rev() {
|
||||
let mut v = [0u8, 1, 2, 3, 4, 5, 6];
|
||||
for (i, chunk) in v.mut_chunks(3).rev().enumerate() {
|
||||
for x in chunk.mut_iter() {
|
||||
for (i, chunk) in v.chunks_mut(3).rev().enumerate() {
|
||||
for x in chunk.iter_mut() {
|
||||
*x = i as u8;
|
||||
}
|
||||
}
|
||||
@ -2173,7 +2173,7 @@ mod tests {
|
||||
#[should_fail]
|
||||
fn test_mut_chunks_0() {
|
||||
let mut v = [1i, 2, 3, 4];
|
||||
let _it = v.mut_chunks(0);
|
||||
let _it = v.chunks_mut(0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -2207,11 +2207,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_mut_last() {
|
||||
let mut x = [1i, 2, 3, 4, 5];
|
||||
let h = x.mut_last();
|
||||
let h = x.last_mut();
|
||||
assert_eq!(*h.unwrap(), 5);
|
||||
|
||||
let y: &mut [int] = [];
|
||||
assert!(y.mut_last().is_none());
|
||||
assert!(y.last_mut().is_none());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2248,7 +2248,7 @@ mod bench {
|
||||
|
||||
b.iter(|| {
|
||||
let mut i = 0i;
|
||||
for x in v.mut_iter() {
|
||||
for x in v.iter_mut() {
|
||||
*x = i;
|
||||
i += 1;
|
||||
}
|
||||
@ -2382,7 +2382,7 @@ mod bench {
|
||||
unsafe {
|
||||
v.set_len(1024);
|
||||
}
|
||||
for x in v.mut_iter() {
|
||||
for x in v.iter_mut() {
|
||||
*x = 0i;
|
||||
}
|
||||
v
|
||||
|
@ -163,7 +163,7 @@ impl<V:Clone> Clone for SmallIntMap<V> {
|
||||
#[inline]
|
||||
fn clone_from(&mut self, source: &SmallIntMap<V>) {
|
||||
self.v.reserve(source.v.len());
|
||||
for (i, w) in self.v.mut_iter().enumerate() {
|
||||
for (i, w) in self.v.iter_mut().enumerate() {
|
||||
*w = source.v[i].clone();
|
||||
}
|
||||
}
|
||||
@ -280,7 +280,7 @@ impl<V> SmallIntMap<V> {
|
||||
/// map.insert(2, "b");
|
||||
/// map.insert(3, "c");
|
||||
///
|
||||
/// for (key, value) in map.mut_iter() {
|
||||
/// for (key, value) in map.iter_mut() {
|
||||
/// *value = "x";
|
||||
/// }
|
||||
///
|
||||
@ -292,7 +292,7 @@ impl<V> SmallIntMap<V> {
|
||||
MutEntries {
|
||||
front: 0,
|
||||
back: self.v.len(),
|
||||
iter: self.v.mut_iter()
|
||||
iter: self.v.iter_mut()
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ impl<V> SmallIntMap<V> {
|
||||
/// map.insert(2, "b");
|
||||
///
|
||||
/// // Not possible with .iter()
|
||||
/// let vec: Vec<(uint, &str)> = map.move_iter().collect();
|
||||
/// let vec: Vec<(uint, &str)> = map.into_iter().collect();
|
||||
///
|
||||
/// assert_eq!(vec, vec![(1, "a"), (2, "b"), (3, "c")]);
|
||||
/// ```
|
||||
@ -328,7 +328,7 @@ impl<V> SmallIntMap<V> {
|
||||
Enumerate<vec::MoveItems<Option<V>>>>
|
||||
{
|
||||
let values = replace(&mut self.v, vec!());
|
||||
values.move_iter().enumerate().filter_map(|(i, v)| {
|
||||
values.into_iter().enumerate().filter_map(|(i, v)| {
|
||||
v.map(|v| (i, v))
|
||||
})
|
||||
}
|
||||
@ -692,8 +692,8 @@ mod test_map {
|
||||
|
||||
assert_eq!(m.iter().size_hint(), (0, Some(11)));
|
||||
assert_eq!(m.iter().rev().size_hint(), (0, Some(11)));
|
||||
assert_eq!(m.mut_iter().size_hint(), (0, Some(11)));
|
||||
assert_eq!(m.mut_iter().rev().size_hint(), (0, Some(11)));
|
||||
assert_eq!(m.iter_mut().size_hint(), (0, Some(11)));
|
||||
assert_eq!(m.iter_mut().rev().size_hint(), (0, Some(11)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -706,7 +706,7 @@ mod test_map {
|
||||
assert!(m.insert(6, 10));
|
||||
assert!(m.insert(10, 11));
|
||||
|
||||
for (k, v) in m.mut_iter() {
|
||||
for (k, v) in m.iter_mut() {
|
||||
*v += k as int;
|
||||
}
|
||||
|
||||
@ -748,7 +748,7 @@ mod test_map {
|
||||
assert!(m.insert(6, 10));
|
||||
assert!(m.insert(10, 11));
|
||||
|
||||
for (k, v) in m.mut_iter().rev() {
|
||||
for (k, v) in m.iter_mut().rev() {
|
||||
*v += k as int;
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ mod test_map {
|
||||
let mut m = SmallIntMap::new();
|
||||
m.insert(1, box 2i);
|
||||
let mut called = false;
|
||||
for (k, v) in m.move_iter() {
|
||||
for (k, v) in m.into_iter() {
|
||||
assert!(!called);
|
||||
called = true;
|
||||
assert_eq!(k, 1);
|
||||
|
@ -380,7 +380,7 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// map.insert("b", 2i);
|
||||
///
|
||||
/// // Add 10 until we find "b"
|
||||
/// for (key, value) in map.mut_iter() {
|
||||
/// for (key, value) in map.iter_mut() {
|
||||
/// *value += 10;
|
||||
/// if key == &"b" { break }
|
||||
/// }
|
||||
@ -417,7 +417,7 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// map.insert("b", 2i);
|
||||
///
|
||||
/// // Add 10 until we find "b"
|
||||
/// for (key, value) in map.mut_rev_iter() {
|
||||
/// for (key, value) in map.rev_iter_mut() {
|
||||
/// *value += 10;
|
||||
/// if key == &"b" { break }
|
||||
/// }
|
||||
@ -427,11 +427,11 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// assert_eq!(map.find(&"c"), Some(&13));
|
||||
/// ```
|
||||
pub fn rev_iter_mut<'a>(&'a mut self) -> RevMutEntries<'a, K, V> {
|
||||
RevMutEntries{iter: self.mut_iter()}
|
||||
RevMutEntries{iter: self.iter_mut()}
|
||||
}
|
||||
|
||||
/// Deprecated: use `into_iter`.
|
||||
#[depreated = "use into_iter"]
|
||||
#[deprecated = "use into_iter"]
|
||||
pub fn move_iter(self) -> MoveEntries<K, V> {
|
||||
self.into_iter()
|
||||
}
|
||||
@ -448,7 +448,7 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// map.insert("b", 2i);
|
||||
///
|
||||
/// // Not possible with a regular `.iter()`
|
||||
/// let vec: Vec<(&str, int)> = map.move_iter().collect();
|
||||
/// let vec: Vec<(&str, int)> = map.into_iter().collect();
|
||||
/// assert_eq!(vec, vec![("a", 1), ("b", 2), ("c", 3)]);
|
||||
/// ```
|
||||
pub fn into_iter(self) -> MoveEntries<K, V> {
|
||||
@ -512,7 +512,7 @@ impl<K, V> TreeMap<K, V> {
|
||||
/// t.insert("User-Agent", "Curl-Rust/0.1");
|
||||
///
|
||||
/// let new_ua = "Safari/156.0";
|
||||
/// match t.find_mut_with(|k| "User-Agent".cmp(k)) {
|
||||
/// match t.find_with_mut(|k| "User-Agent".cmp(k)) {
|
||||
/// Some(x) => *x = new_ua,
|
||||
/// None => fail!(),
|
||||
/// }
|
||||
@ -649,11 +649,11 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// map.insert(6, "c");
|
||||
/// map.insert(8, "d");
|
||||
///
|
||||
/// assert_eq!(map.mut_lower_bound(&4).next(), Some((&4, &mut "b")));
|
||||
/// assert_eq!(map.mut_lower_bound(&5).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.mut_lower_bound(&10).next(), None);
|
||||
/// assert_eq!(map.lower_bound_mut(&4).next(), Some((&4, &mut "b")));
|
||||
/// assert_eq!(map.lower_bound_mut(&5).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.lower_bound_mut(&10).next(), None);
|
||||
///
|
||||
/// for (key, value) in map.mut_lower_bound(&4) {
|
||||
/// for (key, value) in map.lower_bound_mut(&4) {
|
||||
/// *value = "changed";
|
||||
/// }
|
||||
///
|
||||
@ -689,11 +689,11 @@ impl<K: Ord, V> TreeMap<K, V> {
|
||||
/// map.insert(6, "c");
|
||||
/// map.insert(8, "d");
|
||||
///
|
||||
/// assert_eq!(map.mut_upper_bound(&4).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.mut_upper_bound(&5).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.mut_upper_bound(&10).next(), None);
|
||||
/// assert_eq!(map.upper_bound_mut(&4).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.upper_bound_mut(&5).next(), Some((&6, &mut "c")));
|
||||
/// assert_eq!(map.upper_bound_mut(&10).next(), None);
|
||||
///
|
||||
/// for (key, value) in map.mut_upper_bound(&4) {
|
||||
/// for (key, value) in map.upper_bound_mut(&4) {
|
||||
/// *value = "changed";
|
||||
/// }
|
||||
///
|
||||
@ -919,7 +919,7 @@ fn deref_mut<K, V>(x: &mut Option<Box<TreeNode<K, V>>>)
|
||||
let n: &mut TreeNode<K, V> = &mut **n;
|
||||
n as *mut TreeNode<K, V>
|
||||
}
|
||||
None => ptr::mut_null()
|
||||
None => ptr::null_mut()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1220,7 +1220,7 @@ impl<T: Ord> TreeSet<T> {
|
||||
/// let set: TreeSet<int> = [1i, 4, 3, 5, 2].iter().map(|&x| x).collect();
|
||||
///
|
||||
/// // Not possible with a regular `.iter()`
|
||||
/// let v: Vec<int> = set.move_iter().collect();
|
||||
/// let v: Vec<int> = set.into_iter().collect();
|
||||
/// assert_eq!(v, vec![1, 2, 3, 4, 5]);
|
||||
/// ```
|
||||
#[inline]
|
||||
@ -1583,7 +1583,7 @@ fn remove<K: Ord, V>(node: &mut Option<Box<TreeNode<K, V>>>,
|
||||
fn heir_swap<K: Ord, V>(node: &mut Box<TreeNode<K, V>>,
|
||||
child: &mut Option<Box<TreeNode<K, V>>>) {
|
||||
// *could* be done without recursion, but it won't borrow check
|
||||
for x in child.mut_iter() {
|
||||
for x in child.iter_mut() {
|
||||
if x.right.is_some() {
|
||||
heir_swap(node, &mut x.right);
|
||||
} else {
|
||||
@ -1639,18 +1639,18 @@ fn remove<K: Ord, V>(node: &mut Option<Box<TreeNode<K, V>>>,
|
||||
|
||||
if right_level > save.level {
|
||||
let save_level = save.level;
|
||||
for x in save.right.mut_iter() { x.level = save_level }
|
||||
for x in save.right.iter_mut() { x.level = save_level }
|
||||
}
|
||||
|
||||
skew(save);
|
||||
|
||||
for right in save.right.mut_iter() {
|
||||
for right in save.right.iter_mut() {
|
||||
skew(right);
|
||||
for x in right.right.mut_iter() { skew(x) }
|
||||
for x in right.right.iter_mut() { skew(x) }
|
||||
}
|
||||
|
||||
split(save);
|
||||
for x in save.right.mut_iter() { split(x) }
|
||||
for x in save.right.iter_mut() { split(x) }
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -1780,7 +1780,7 @@ mod test_treemap {
|
||||
assert!(m.insert("t2", 8));
|
||||
assert!(m.insert("t5", 14));
|
||||
let new = 100;
|
||||
match m.find_mut_with(|k| "t5".cmp(k)) {
|
||||
match m.find_with_mut(|k| "t5".cmp(k)) {
|
||||
None => fail!(), Some(x) => *x = new
|
||||
}
|
||||
assert_eq!(m.find_with(|k| "t5".cmp(k)), Some(&new));
|
||||
@ -2006,7 +2006,7 @@ mod test_treemap {
|
||||
assert!(m.insert(i, 100 * i));
|
||||
}
|
||||
|
||||
for (i, (&k, v)) in m.mut_iter().enumerate() {
|
||||
for (i, (&k, v)) in m.iter_mut().enumerate() {
|
||||
*v += k * 10 + i; // 000 + 00 + 0, 100 + 10 + 1, ...
|
||||
}
|
||||
|
||||
@ -2021,7 +2021,7 @@ mod test_treemap {
|
||||
assert!(m.insert(i, 100 * i));
|
||||
}
|
||||
|
||||
for (i, (&k, v)) in m.mut_rev_iter().enumerate() {
|
||||
for (i, (&k, v)) in m.rev_iter_mut().enumerate() {
|
||||
*v += k * 10 + (9 - i); // 900 + 90 + (9 - 0), 800 + 80 + (9 - 1), ...
|
||||
}
|
||||
|
||||
@ -2040,23 +2040,23 @@ mod test_treemap {
|
||||
}
|
||||
|
||||
for i in range(1i, 199) {
|
||||
let mut lb_it = m_lower.mut_lower_bound(&i);
|
||||
let mut lb_it = m_lower.lower_bound_mut(&i);
|
||||
let (&k, v) = lb_it.next().unwrap();
|
||||
let lb = i + i % 2;
|
||||
assert_eq!(lb, k);
|
||||
*v -= k;
|
||||
}
|
||||
for i in range(0i, 198) {
|
||||
let mut ub_it = m_upper.mut_upper_bound(&i);
|
||||
let mut ub_it = m_upper.upper_bound_mut(&i);
|
||||
let (&k, v) = ub_it.next().unwrap();
|
||||
let ub = i + 2 - i % 2;
|
||||
assert_eq!(ub, k);
|
||||
*v -= k;
|
||||
}
|
||||
|
||||
assert!(m_lower.mut_lower_bound(&199).next().is_none());
|
||||
assert!(m_lower.lower_bound_mut(&199).next().is_none());
|
||||
|
||||
assert!(m_upper.mut_upper_bound(&198).next().is_none());
|
||||
assert!(m_upper.upper_bound_mut(&198).next().is_none());
|
||||
|
||||
assert!(m_lower.iter().all(|(_, &x)| x == 0));
|
||||
assert!(m_upper.iter().all(|(_, &x)| x == 0));
|
||||
@ -2065,7 +2065,7 @@ mod test_treemap {
|
||||
#[test]
|
||||
fn test_keys() {
|
||||
let vec = vec![(1i, 'a'), (2i, 'b'), (3i, 'c')];
|
||||
let map = vec.move_iter().collect::<TreeMap<int, char>>();
|
||||
let map = vec.into_iter().collect::<TreeMap<int, char>>();
|
||||
let keys = map.keys().map(|&k| k).collect::<Vec<int>>();
|
||||
assert_eq!(keys.len(), 3);
|
||||
assert!(keys.contains(&1));
|
||||
@ -2076,7 +2076,7 @@ mod test_treemap {
|
||||
#[test]
|
||||
fn test_values() {
|
||||
let vec = vec![(1i, 'a'), (2i, 'b'), (3i, 'c')];
|
||||
let map = vec.move_iter().collect::<TreeMap<int, char>>();
|
||||
let map = vec.into_iter().collect::<TreeMap<int, char>>();
|
||||
let values = map.values().map(|&v| v).collect::<Vec<char>>();
|
||||
assert_eq!(values.len(), 3);
|
||||
assert!(values.contains(&'a'));
|
||||
@ -2402,7 +2402,7 @@ mod test_set {
|
||||
let s: TreeSet<int> = range(0i, 5).collect();
|
||||
|
||||
let mut n = 0;
|
||||
for x in s.move_iter() {
|
||||
for x in s.into_iter() {
|
||||
assert_eq!(x, n);
|
||||
n += 1;
|
||||
}
|
||||
@ -2410,9 +2410,9 @@ mod test_set {
|
||||
|
||||
#[test]
|
||||
fn test_move_iter_size_hint() {
|
||||
let s: TreeSet<int> = vec!(0i, 1).move_iter().collect();
|
||||
let s: TreeSet<int> = vec!(0i, 1).into_iter().collect();
|
||||
|
||||
let mut it = s.move_iter();
|
||||
let mut it = s.into_iter();
|
||||
|
||||
assert_eq!(it.size_hint(), (2, Some(2)));
|
||||
assert!(it.next() != None);
|
||||
|
@ -282,7 +282,7 @@ impl<T> TrieMap<T> {
|
||||
/// use std::collections::TrieMap;
|
||||
/// let mut map: TrieMap<int> = [(1, 2), (2, 4), (3, 6)].iter().map(|&x| x).collect();
|
||||
///
|
||||
/// for (key, value) in map.mut_iter() {
|
||||
/// for (key, value) in map.iter_mut() {
|
||||
/// *value = -(key as int);
|
||||
/// }
|
||||
///
|
||||
@ -292,7 +292,7 @@ impl<T> TrieMap<T> {
|
||||
/// ```
|
||||
pub fn iter_mut<'a>(&'a mut self) -> MutEntries<'a, T> {
|
||||
let mut iter = unsafe {MutEntries::new()};
|
||||
iter.stack[0] = self.root.children.mut_iter();
|
||||
iter.stack[0] = self.root.children.iter_mut();
|
||||
iter.length = 1;
|
||||
iter.remaining_min = self.length;
|
||||
iter.remaining_max = self.length;
|
||||
@ -453,11 +453,11 @@ impl<T> TrieMap<T> {
|
||||
/// use std::collections::TrieMap;
|
||||
/// let mut map: TrieMap<&str> = [(2, "a"), (4, "b"), (6, "c")].iter().map(|&x| x).collect();
|
||||
///
|
||||
/// assert_eq!(map.mut_lower_bound(4).next(), Some((4, &mut "b")));
|
||||
/// assert_eq!(map.mut_lower_bound(5).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.mut_lower_bound(10).next(), None);
|
||||
/// assert_eq!(map.lower_bound_mut(4).next(), Some((4, &mut "b")));
|
||||
/// assert_eq!(map.lower_bound_mut(5).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.lower_bound_mut(10).next(), None);
|
||||
///
|
||||
/// for (key, value) in map.mut_lower_bound(4) {
|
||||
/// for (key, value) in map.lower_bound_mut(4) {
|
||||
/// *value = "changed";
|
||||
/// }
|
||||
///
|
||||
@ -484,11 +484,11 @@ impl<T> TrieMap<T> {
|
||||
/// use std::collections::TrieMap;
|
||||
/// let mut map: TrieMap<&str> = [(2, "a"), (4, "b"), (6, "c")].iter().map(|&x| x).collect();
|
||||
///
|
||||
/// assert_eq!(map.mut_upper_bound(4).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.mut_upper_bound(5).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.mut_upper_bound(10).next(), None);
|
||||
/// assert_eq!(map.upper_bound_mut(4).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.upper_bound_mut(5).next(), Some((6, &mut "c")));
|
||||
/// assert_eq!(map.upper_bound_mut(10).next(), None);
|
||||
///
|
||||
/// for (key, value) in map.mut_upper_bound(4) {
|
||||
/// for (key, value) in map.upper_bound_mut(4) {
|
||||
/// *value = "changed";
|
||||
/// }
|
||||
///
|
||||
@ -1195,7 +1195,7 @@ mod test_map {
|
||||
#[test]
|
||||
fn test_keys() {
|
||||
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
|
||||
let map = vec.move_iter().collect::<TrieMap<char>>();
|
||||
let map = vec.into_iter().collect::<TrieMap<char>>();
|
||||
let keys = map.keys().collect::<Vec<uint>>();
|
||||
assert_eq!(keys.len(), 3);
|
||||
assert!(keys.contains(&1));
|
||||
@ -1206,7 +1206,7 @@ mod test_map {
|
||||
#[test]
|
||||
fn test_values() {
|
||||
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
|
||||
let map = vec.move_iter().collect::<TrieMap<char>>();
|
||||
let map = vec.into_iter().collect::<TrieMap<char>>();
|
||||
let values = map.values().map(|&v| v).collect::<Vec<char>>();
|
||||
assert_eq!(values.len(), 3);
|
||||
assert!(values.contains(&'a'));
|
||||
@ -1239,7 +1239,7 @@ mod test_map {
|
||||
#[test]
|
||||
fn test_mut_iter() {
|
||||
let mut empty_map : TrieMap<uint> = TrieMap::new();
|
||||
assert!(empty_map.mut_iter().next().is_none());
|
||||
assert!(empty_map.iter_mut().next().is_none());
|
||||
|
||||
let first = uint::MAX - 10000;
|
||||
let last = uint::MAX;
|
||||
@ -1250,7 +1250,7 @@ mod test_map {
|
||||
}
|
||||
|
||||
let mut i = 0;
|
||||
for (k, v) in map.mut_iter() {
|
||||
for (k, v) in map.iter_mut() {
|
||||
assert_eq!(k, first + i);
|
||||
*v -= k / 2;
|
||||
i += 1;
|
||||
@ -1316,7 +1316,7 @@ mod test_map {
|
||||
}
|
||||
|
||||
for i in range(0u, 199) {
|
||||
let mut lb_it = m_lower.mut_lower_bound(i);
|
||||
let mut lb_it = m_lower.lower_bound_mut(i);
|
||||
let (k, v) = lb_it.next().unwrap();
|
||||
let lb = i + i % 2;
|
||||
assert_eq!(lb, k);
|
||||
@ -1324,15 +1324,15 @@ mod test_map {
|
||||
}
|
||||
|
||||
for i in range(0u, 198) {
|
||||
let mut ub_it = m_upper.mut_upper_bound(i);
|
||||
let mut ub_it = m_upper.upper_bound_mut(i);
|
||||
let (k, v) = ub_it.next().unwrap();
|
||||
let ub = i + 2 - i % 2;
|
||||
assert_eq!(ub, k);
|
||||
*v -= k;
|
||||
}
|
||||
|
||||
assert!(m_lower.mut_lower_bound(199).next().is_none());
|
||||
assert!(m_upper.mut_upper_bound(198).next().is_none());
|
||||
assert!(m_lower.lower_bound_mut(199).next().is_none());
|
||||
assert!(m_upper.upper_bound_mut(198).next().is_none());
|
||||
|
||||
assert!(m_lower.iter().all(|(_, &x)| x == 0));
|
||||
assert!(m_upper.iter().all(|(_, &x)| x == 0));
|
||||
|
@ -181,7 +181,7 @@ impl<T> Vec<T> {
|
||||
let mut xs = Vec::with_capacity(length);
|
||||
while xs.len < length {
|
||||
let len = xs.len;
|
||||
ptr::write(xs.as_mut_slice().unsafe_mut_ref(len), op(len));
|
||||
ptr::write(xs.as_mut_slice().unsafe_mut(len), op(len));
|
||||
xs.len += 1;
|
||||
}
|
||||
xs
|
||||
@ -252,7 +252,7 @@ impl<T> Vec<T> {
|
||||
let mut lefts = Vec::new();
|
||||
let mut rights = Vec::new();
|
||||
|
||||
for elt in self.move_iter() {
|
||||
for elt in self.into_iter() {
|
||||
if f(&elt) {
|
||||
lefts.push(elt);
|
||||
} else {
|
||||
@ -311,7 +311,7 @@ impl<T: Clone> Vec<T> {
|
||||
let mut xs = Vec::with_capacity(length);
|
||||
while xs.len < length {
|
||||
let len = xs.len;
|
||||
ptr::write(xs.as_mut_slice().unsafe_mut_ref(len),
|
||||
ptr::write(xs.as_mut_slice().unsafe_mut(len),
|
||||
value.clone());
|
||||
xs.len += 1;
|
||||
}
|
||||
@ -343,7 +343,7 @@ impl<T: Clone> Vec<T> {
|
||||
// during the loop can prevent this optimisation.
|
||||
unsafe {
|
||||
ptr::write(
|
||||
self.as_mut_slice().unsafe_mut_ref(len),
|
||||
self.as_mut_slice().unsafe_mut(len),
|
||||
other.unsafe_get(i).clone());
|
||||
self.set_len(len + 1);
|
||||
}
|
||||
@ -437,7 +437,7 @@ impl<T:Clone> Clone for Vec<T> {
|
||||
}
|
||||
|
||||
// reuse the contained values' allocations/resources.
|
||||
for (place, thing) in self.mut_iter().zip(other.iter()) {
|
||||
for (place, thing) in self.iter_mut().zip(other.iter()) {
|
||||
place.clone_from(thing)
|
||||
}
|
||||
|
||||
@ -738,7 +738,7 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let v = vec!["a".to_string(), "b".to_string()];
|
||||
/// for s in v.move_iter() {
|
||||
/// for s in v.into_iter() {
|
||||
/// // s has type String, not &String
|
||||
/// println!("{}", s);
|
||||
/// }
|
||||
@ -841,13 +841,13 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1i, 2, 3];
|
||||
/// for num in vec.mut_iter() {
|
||||
/// for num in vec.iter_mut() {
|
||||
/// *num = 0;
|
||||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a,T> {
|
||||
self.as_mut_slice().mut_iter()
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
/// Sorts the vector, in place, using `compare` to compare elements.
|
||||
@ -951,12 +951,12 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1i, 2, 3];
|
||||
/// *vec.mut_last().unwrap() = 4;
|
||||
/// *vec.last_mut().unwrap() = 4;
|
||||
/// assert_eq!(vec, vec![1i, 2, 4]);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn last_mut<'a>(&'a mut self) -> Option<&'a mut T> {
|
||||
self.as_mut_slice().mut_last()
|
||||
self.as_mut_slice().last_mut()
|
||||
}
|
||||
|
||||
/// Removes an element from anywhere in the vector and return it, replacing
|
||||
@ -1119,7 +1119,7 @@ impl<T> Vec<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn push_all_move(&mut self, other: Vec<T>) {
|
||||
self.extend(other.move_iter());
|
||||
self.extend(other.into_iter());
|
||||
}
|
||||
|
||||
/// Deprecated: use `slice_mut`.
|
||||
@ -1140,12 +1140,12 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1i, 2, 3, 4];
|
||||
/// assert!(vec.mut_slice(0, 2) == [1, 2]);
|
||||
/// assert!(vec.slice_mut(0, 2) == [1, 2]);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn slice_mut<'a>(&'a mut self, start: uint, end: uint)
|
||||
-> &'a mut [T] {
|
||||
self.as_mut_slice().mut_slice(start, end)
|
||||
self.as_mut_slice().slice_mut(start, end)
|
||||
}
|
||||
|
||||
/// Deprecated: use "slice_from_mut".
|
||||
@ -1164,11 +1164,11 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1i, 2, 3, 4];
|
||||
/// assert!(vec.mut_slice_from(2) == [3, 4]);
|
||||
/// assert!(vec.slice_from_mut(2) == [3, 4]);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||
self.as_mut_slice().mut_slice_from(start)
|
||||
self.as_mut_slice().slice_from_mut(start)
|
||||
}
|
||||
|
||||
/// Deprecated: use `slice_to_mut`.
|
||||
@ -1187,11 +1187,11 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// ```
|
||||
/// let mut vec = vec![1i, 2, 3, 4];
|
||||
/// assert!(vec.mut_slice_to(2) == [1, 2]);
|
||||
/// assert!(vec.slice_to_mut(2) == [1, 2]);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn slice_to_mut<'a>(&'a mut self, end: uint) -> &'a mut [T] {
|
||||
self.as_mut_slice().mut_slice_to(end)
|
||||
self.as_mut_slice().slice_to_mut(end)
|
||||
}
|
||||
|
||||
/// Deprecated: use `split_at_mut`.
|
||||
@ -1217,26 +1217,26 @@ impl<T> Vec<T> {
|
||||
///
|
||||
/// // scoped to restrict the lifetime of the borrows
|
||||
/// {
|
||||
/// let (left, right) = vec.mut_split_at(0);
|
||||
/// let (left, right) = vec.split_at_mut(0);
|
||||
/// assert!(left == &mut []);
|
||||
/// assert!(right == &mut [1, 2, 3, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = vec.mut_split_at(2);
|
||||
/// let (left, right) = vec.split_at_mut(2);
|
||||
/// assert!(left == &mut [1, 2]);
|
||||
/// assert!(right == &mut [3, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = vec.mut_split_at(6);
|
||||
/// let (left, right) = vec.split_at_mut(6);
|
||||
/// assert!(left == &mut [1, 2, 3, 4, 5, 6]);
|
||||
/// assert!(right == &mut []);
|
||||
/// }
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn split_at_mut<'a>(&'a mut self, mid: uint) -> (&'a mut [T], &'a mut [T]) {
|
||||
self.as_mut_slice().mut_split_at(mid)
|
||||
self.as_mut_slice().split_at_mut(mid)
|
||||
}
|
||||
|
||||
/// Reverses the order of elements in a vector, in place.
|
||||
@ -2111,9 +2111,9 @@ mod tests {
|
||||
fn test_mut_slice_from() {
|
||||
let mut values = Vec::from_slice([1u8,2,3,4,5]);
|
||||
{
|
||||
let slice = values.mut_slice_from(2);
|
||||
let slice = values.slice_from_mut(2);
|
||||
assert!(slice == [3, 4, 5]);
|
||||
for p in slice.mut_iter() {
|
||||
for p in slice.iter_mut() {
|
||||
*p += 2;
|
||||
}
|
||||
}
|
||||
@ -2125,9 +2125,9 @@ mod tests {
|
||||
fn test_mut_slice_to() {
|
||||
let mut values = Vec::from_slice([1u8,2,3,4,5]);
|
||||
{
|
||||
let slice = values.mut_slice_to(2);
|
||||
let slice = values.slice_to_mut(2);
|
||||
assert!(slice == [1, 2]);
|
||||
for p in slice.mut_iter() {
|
||||
for p in slice.iter_mut() {
|
||||
*p += 1;
|
||||
}
|
||||
}
|
||||
@ -2139,14 +2139,14 @@ mod tests {
|
||||
fn test_mut_split_at() {
|
||||
let mut values = Vec::from_slice([1u8,2,3,4,5]);
|
||||
{
|
||||
let (left, right) = values.mut_split_at(2);
|
||||
let (left, right) = values.split_at_mut(2);
|
||||
assert!(left.slice(0, left.len()) == [1, 2]);
|
||||
for p in left.mut_iter() {
|
||||
for p in left.iter_mut() {
|
||||
*p += 1;
|
||||
}
|
||||
|
||||
assert!(right.slice(0, right.len()) == [3, 4, 5]);
|
||||
for p in right.mut_iter() {
|
||||
for p in right.iter_mut() {
|
||||
*p += 2;
|
||||
}
|
||||
}
|
||||
@ -2223,15 +2223,15 @@ mod tests {
|
||||
|
||||
for &() in v.iter() {}
|
||||
|
||||
assert_eq!(v.mut_iter().count(), 2);
|
||||
assert_eq!(v.iter_mut().count(), 2);
|
||||
v.push(());
|
||||
assert_eq!(v.mut_iter().count(), 3);
|
||||
assert_eq!(v.iter_mut().count(), 3);
|
||||
v.push(());
|
||||
assert_eq!(v.mut_iter().count(), 4);
|
||||
assert_eq!(v.iter_mut().count(), 4);
|
||||
|
||||
for &() in v.mut_iter() {}
|
||||
for &() in v.iter_mut() {}
|
||||
unsafe { v.set_len(0); }
|
||||
assert_eq!(v.mut_iter().count(), 0);
|
||||
assert_eq!(v.iter_mut().count(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -2339,7 +2339,7 @@ mod tests {
|
||||
vec.push(1);
|
||||
vec.push(2);
|
||||
let ptr = vec.as_ptr();
|
||||
vec = vec.move_iter().unwrap();
|
||||
vec = vec.into_iter().unwrap();
|
||||
assert_eq!(vec.as_ptr(), ptr);
|
||||
assert_eq!(vec.capacity(), 7);
|
||||
assert_eq!(vec.len(), 0);
|
||||
@ -2495,7 +2495,7 @@ mod tests {
|
||||
b.bytes = src_len as u64;
|
||||
|
||||
b.iter(|| {
|
||||
let dst: Vec<uint> = FromIterator::from_iter(src.clone().move_iter());
|
||||
let dst: Vec<uint> = FromIterator::from_iter(src.clone().into_iter());
|
||||
assert_eq!(dst.len(), src_len);
|
||||
assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
|
||||
});
|
||||
@ -2529,7 +2529,7 @@ mod tests {
|
||||
|
||||
b.iter(|| {
|
||||
let mut dst = dst.clone();
|
||||
dst.extend(src.clone().move_iter());
|
||||
dst.extend(src.clone().into_iter());
|
||||
assert_eq!(dst.len(), dst_len + src_len);
|
||||
assert!(dst.iter().enumerate().all(|(i, x)| i == *x));
|
||||
});
|
||||
|
@ -203,7 +203,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
|
||||
_ => ()
|
||||
}
|
||||
|
||||
buf.mut_slice_to(end).reverse();
|
||||
buf.slice_to_mut(end).reverse();
|
||||
|
||||
// Remember start of the fractional digits.
|
||||
// Points one beyond end of buf if none get generated,
|
||||
@ -342,7 +342,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>(
|
||||
|
||||
impl<'a> fmt::FormatWriter for Filler<'a> {
|
||||
fn write(&mut self, bytes: &[u8]) -> fmt::Result {
|
||||
slice::bytes::copy_memory(self.buf.mut_slice_from(*self.end),
|
||||
slice::bytes::copy_memory(self.buf.slice_from_mut(*self.end),
|
||||
bytes);
|
||||
*self.end += bytes.len();
|
||||
Ok(())
|
||||
|
@ -420,7 +420,7 @@ impl<'a> Formatter<'a> {
|
||||
|
||||
// Writes the sign if it exists, and then the prefix if it was requested
|
||||
let write_prefix = |f: &mut Formatter| {
|
||||
for c in sign.move_iter() {
|
||||
for c in sign.into_iter() {
|
||||
let mut b = [0, ..4];
|
||||
let n = c.encode_utf8(b).unwrap_or(0);
|
||||
try!(f.buf.write(b.slice_to(n)));
|
||||
|
@ -43,7 +43,7 @@ trait GenericRadix {
|
||||
if is_positive {
|
||||
// Accumulate each digit of the number from the least significant
|
||||
// to the most significant figure.
|
||||
for byte in buf.mut_iter().rev() {
|
||||
for byte in buf.iter_mut().rev() {
|
||||
let n = x % base; // Get the current place value.
|
||||
x = x / base; // Deaccumulate the number.
|
||||
*byte = self.digit(cast(n).unwrap()); // Store the digit in the buffer.
|
||||
@ -52,7 +52,7 @@ trait GenericRadix {
|
||||
}
|
||||
} else {
|
||||
// Do the same as above, but accounting for two's complement.
|
||||
for byte in buf.mut_iter().rev() {
|
||||
for byte in buf.iter_mut().rev() {
|
||||
let n = -(x % base); // Get the current place value.
|
||||
x = x / base; // Deaccumulate the number.
|
||||
*byte = self.digit(cast(n).unwrap()); // Store the digit in the buffer.
|
||||
|
@ -377,7 +377,7 @@ pub trait Iterator<A> {
|
||||
/// sum
|
||||
/// }
|
||||
/// let x = vec![1i,2,3,7,8,9];
|
||||
/// assert_eq!(process(x.move_iter()), 1006);
|
||||
/// assert_eq!(process(x.into_iter()), 1006);
|
||||
/// ```
|
||||
#[inline]
|
||||
fn fuse(self) -> Fuse<Self> {
|
||||
@ -1682,7 +1682,7 @@ impl<'a, A, T: Iterator<A>, B, U: Iterator<B>> Iterator<B> for FlatMap<'a, A, T,
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<B> {
|
||||
loop {
|
||||
for inner in self.frontiter.mut_iter() {
|
||||
for inner in self.frontiter.iter_mut() {
|
||||
for x in *inner {
|
||||
return Some(x)
|
||||
}
|
||||
@ -1713,7 +1713,7 @@ impl<'a,
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<B> {
|
||||
loop {
|
||||
for inner in self.backiter.mut_iter() {
|
||||
for inner in self.backiter.iter_mut() {
|
||||
match inner.next_back() {
|
||||
None => (),
|
||||
y => return y
|
||||
|
@ -124,7 +124,7 @@ pub fn mut_null<T>() -> *mut T { null_mut() }
|
||||
/// ```
|
||||
/// use std::ptr;
|
||||
///
|
||||
/// let p: *mut int = ptr::mut_null();
|
||||
/// let p: *mut int = ptr::null_mut();
|
||||
/// assert!(p.is_null());
|
||||
/// ```
|
||||
#[inline]
|
||||
@ -327,7 +327,7 @@ impl<T> RawPtr<T> for *const T {
|
||||
|
||||
impl<T> RawPtr<T> for *mut T {
|
||||
#[inline]
|
||||
fn null() -> *mut T { mut_null() }
|
||||
fn null() -> *mut T { null_mut() }
|
||||
|
||||
#[inline]
|
||||
fn is_null(&self) -> bool { *self == RawPtr::null() }
|
||||
|
@ -583,7 +583,7 @@ pub trait MutableSlice<'a, T> {
|
||||
* ```ignore
|
||||
* if self.len() == 0 { return None; }
|
||||
* let head = &mut self[0];
|
||||
* *self = self.mut_slice_from(1);
|
||||
* *self = self.slice_from_mut(1);
|
||||
* Some(head)
|
||||
* ```
|
||||
*
|
||||
@ -602,7 +602,7 @@ pub trait MutableSlice<'a, T> {
|
||||
* ```ignore
|
||||
* if self.len() == 0 { return None; }
|
||||
* let tail = &mut self[self.len() - 1];
|
||||
* *self = self.mut_slice_to(self.len() - 1);
|
||||
* *self = self.slice_to_mut(self.len() - 1);
|
||||
* Some(tail)
|
||||
* ```
|
||||
*
|
||||
@ -650,19 +650,19 @@ pub trait MutableSlice<'a, T> {
|
||||
///
|
||||
/// // scoped to restrict the lifetime of the borrows
|
||||
/// {
|
||||
/// let (left, right) = v.mut_split_at(0);
|
||||
/// let (left, right) = v.split_at_mut(0);
|
||||
/// assert!(left == &mut []);
|
||||
/// assert!(right == &mut [1i, 2, 3, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = v.mut_split_at(2);
|
||||
/// let (left, right) = v.split_at_mut(2);
|
||||
/// assert!(left == &mut [1i, 2]);
|
||||
/// assert!(right == &mut [3i, 4, 5, 6]);
|
||||
/// }
|
||||
///
|
||||
/// {
|
||||
/// let (left, right) = v.mut_split_at(6);
|
||||
/// let (left, right) = v.split_at_mut(6);
|
||||
/// assert!(left == &mut [1i, 2, 3, 4, 5, 6]);
|
||||
/// assert!(right == &mut []);
|
||||
/// }
|
||||
@ -768,12 +768,12 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||
#[inline]
|
||||
fn slice_from_mut(self, start: uint) -> &'a mut [T] {
|
||||
let len = self.len();
|
||||
self.mut_slice(start, len)
|
||||
self.slice_mut(start, len)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn slice_to_mut(self, end: uint) -> &'a mut [T] {
|
||||
self.mut_slice(0, end)
|
||||
self.slice_mut(0, end)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -781,7 +781,7 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||
unsafe {
|
||||
let len = self.len();
|
||||
let self2: &'a mut [T] = mem::transmute_copy(&self);
|
||||
(self.mut_slice(0, mid), self2.mut_slice(mid, len))
|
||||
(self.slice_mut(0, mid), self2.slice_mut(mid, len))
|
||||
}
|
||||
}
|
||||
|
||||
@ -861,8 +861,8 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||
while i < ln / 2 {
|
||||
// Unsafe swap to avoid the bounds check in safe swap.
|
||||
unsafe {
|
||||
let pa: *mut T = self.unsafe_mut_ref(i);
|
||||
let pb: *mut T = self.unsafe_mut_ref(ln - i - 1);
|
||||
let pa: *mut T = self.unsafe_mut(i);
|
||||
let pb: *mut T = self.unsafe_mut(ln - i - 1);
|
||||
ptr::swap(pa, pb);
|
||||
}
|
||||
i += 1;
|
||||
@ -881,7 +881,7 @@ impl<'a,T> MutableSlice<'a, T> for &'a mut [T] {
|
||||
|
||||
#[inline]
|
||||
unsafe fn unsafe_set(self, index: uint, val: T) {
|
||||
*self.unsafe_mut_ref(index) = val;
|
||||
*self.unsafe_mut(index) = val;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -1018,7 +1018,7 @@ pub trait MutableCloneableSlice<T> {
|
||||
impl<'a, T:Clone> MutableCloneableSlice<T> for &'a mut [T] {
|
||||
#[inline]
|
||||
fn clone_from_slice(self, src: &[T]) -> uint {
|
||||
for (a, b) in self.mut_iter().zip(src.iter()) {
|
||||
for (a, b) in self.iter_mut().zip(src.iter()) {
|
||||
a.clone_from(b);
|
||||
}
|
||||
cmp::min(self.len(), src.len())
|
||||
@ -1274,14 +1274,14 @@ impl<'a, T> Iterator<&'a mut [T]> for MutSplits<'a, T> {
|
||||
self.finished = true;
|
||||
let tmp = mem::replace(&mut self.v, &mut []);
|
||||
let len = tmp.len();
|
||||
let (head, tail) = tmp.mut_split_at(len);
|
||||
let (head, tail) = tmp.split_at_mut(len);
|
||||
self.v = tail;
|
||||
Some(head)
|
||||
}
|
||||
Some(idx) => {
|
||||
let tmp = mem::replace(&mut self.v, &mut []);
|
||||
let (head, tail) = tmp.mut_split_at(idx);
|
||||
self.v = tail.mut_slice_from(1);
|
||||
let (head, tail) = tmp.split_at_mut(idx);
|
||||
self.v = tail.slice_from_mut(1);
|
||||
Some(head)
|
||||
}
|
||||
}
|
||||
@ -1314,9 +1314,9 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutSplits<'a, T> {
|
||||
}
|
||||
Some(idx) => {
|
||||
let tmp = mem::replace(&mut self.v, &mut []);
|
||||
let (head, tail) = tmp.mut_split_at(idx);
|
||||
let (head, tail) = tmp.split_at_mut(idx);
|
||||
self.v = head;
|
||||
Some(tail.mut_slice_from(1))
|
||||
Some(tail.slice_from_mut(1))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1483,7 +1483,7 @@ impl<'a, T> Iterator<&'a mut [T]> for MutChunks<'a, T> {
|
||||
} else {
|
||||
let sz = cmp::min(self.v.len(), self.chunk_size);
|
||||
let tmp = mem::replace(&mut self.v, &mut []);
|
||||
let (head, tail) = tmp.mut_split_at(sz);
|
||||
let (head, tail) = tmp.split_at_mut(sz);
|
||||
self.v = tail;
|
||||
Some(head)
|
||||
}
|
||||
@ -1512,7 +1512,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
|
||||
let sz = if remainder != 0 { remainder } else { self.chunk_size };
|
||||
let tmp = mem::replace(&mut self.v, &mut []);
|
||||
let tmp_len = tmp.len();
|
||||
let (head, tail) = tmp.mut_split_at(tmp_len - sz);
|
||||
let (head, tail) = tmp.split_at_mut(tmp_len - sz);
|
||||
self.v = head;
|
||||
Some(tail)
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ fn test_range_step_inclusive() {
|
||||
#[test]
|
||||
fn test_reverse() {
|
||||
let mut ys = [1i, 2, 3, 4, 5];
|
||||
ys.mut_iter().reverse_();
|
||||
ys.iter_mut().reverse_();
|
||||
assert!(ys == [5, 4, 3, 2, 1]);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ fn test_mut_iter() {
|
||||
|
||||
let mut x = Some(val);
|
||||
{
|
||||
let mut it = x.mut_iter();
|
||||
let mut it = x.iter_mut();
|
||||
|
||||
assert_eq!(it.size_hint(), (1, Some(1)));
|
||||
|
||||
@ -275,7 +275,7 @@ fn test_collect() {
|
||||
// test that it does not take more elements than it needs
|
||||
let mut functions = [|| Some(()), || None, || fail!()];
|
||||
|
||||
let v: Option<Vec<()>> = collect(functions.mut_iter().map(|f| (*f)()));
|
||||
let v: Option<Vec<()>> = collect(functions.iter_mut().map(|f| (*f)()));
|
||||
|
||||
assert!(v == None);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ fn test_collect() {
|
||||
// test that it does not take more elements than it needs
|
||||
let mut functions = [|| Ok(()), || Err(1i), || fail!()];
|
||||
|
||||
let v: Result<Vec<()>, int> = collect(functions.mut_iter().map(|f| (*f)()));
|
||||
let v: Result<Vec<()>, int> = collect(functions.iter_mut().map(|f| (*f)()));
|
||||
assert!(v == Err(1));
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ fn test_fold() {
|
||||
// test that it does not take more elements than it needs
|
||||
let mut functions = [|| Ok(()), || Err(1i), || fail!()];
|
||||
|
||||
assert_eq!(fold_(functions.mut_iter()
|
||||
assert_eq!(fold_(functions.iter_mut()
|
||||
.map(|f| (*f)())),
|
||||
Err(1));
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ fn list_dir_sorted(path: &Path) -> Option<Vec<Path>> {
|
||||
match fs::readdir(path) {
|
||||
Ok(mut children) => {
|
||||
children.sort_by(|p1, p2| p2.filename().cmp(&p1.filename()));
|
||||
Some(children.move_iter().collect())
|
||||
Some(children.into_iter().collect())
|
||||
}
|
||||
Err(..) => None
|
||||
}
|
||||
@ -505,7 +505,7 @@ fn fill_todo(todo: &mut Vec<(Path, uint)>, patterns: &[Pattern], idx: uint, path
|
||||
None => {
|
||||
match list_dir_sorted(path) {
|
||||
Some(entries) => {
|
||||
todo.extend(entries.move_iter().map(|x|(x, idx)));
|
||||
todo.extend(entries.into_iter().map(|x|(x, idx)));
|
||||
|
||||
// Matching the special directory entries . and .. that refer to
|
||||
// the current and parent directory respectively requires that
|
||||
|
@ -588,12 +588,12 @@ mod tests {
|
||||
fn to_opt_strs(self) -> Vec<Option<&'static str>> {
|
||||
match self {
|
||||
UnlabelledNodes(len)
|
||||
=> Vec::from_elem(len, None).move_iter().collect(),
|
||||
=> Vec::from_elem(len, None).into_iter().collect(),
|
||||
AllNodesLabelled(lbls)
|
||||
=> lbls.move_iter().map(
|
||||
=> lbls.into_iter().map(
|
||||
|l|Some(l)).collect(),
|
||||
SomeNodesLabelled(lbls)
|
||||
=> lbls.move_iter().collect(),
|
||||
=> lbls.into_iter().collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ impl BasicLoop {
|
||||
/// Process everything in the work queue (continually)
|
||||
fn work(&mut self) {
|
||||
while self.work.len() > 0 {
|
||||
for work in mem::replace(&mut self.work, vec![]).move_iter() {
|
||||
for work in mem::replace(&mut self.work, vec![]).into_iter() {
|
||||
work();
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ impl BasicLoop {
|
||||
let messages = unsafe {
|
||||
mem::replace(&mut *self.messages.lock(), Vec::new())
|
||||
};
|
||||
for message in messages.move_iter() {
|
||||
for message in messages.into_iter() {
|
||||
self.message(message);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ impl BasicLoop {
|
||||
fn message(&mut self, message: Message) {
|
||||
match message {
|
||||
RunRemote(i) => {
|
||||
match self.remotes.mut_iter().find(|& &(id, _)| id == i) {
|
||||
match self.remotes.iter_mut().find(|& &(id, _)| id == i) {
|
||||
Some(&(_, ref mut f)) => f.call(),
|
||||
None => unreachable!()
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ impl SchedPool {
|
||||
// Now that we've got all our work queues, create one scheduler per
|
||||
// queue, spawn the scheduler into a thread, and be sure to keep a
|
||||
// handle to the scheduler and the thread to keep them alive.
|
||||
for worker in workers.move_iter() {
|
||||
for worker in workers.into_iter() {
|
||||
rtdebug!("inserting a regular scheduler");
|
||||
|
||||
let mut sched = box Scheduler::new(pool.id,
|
||||
@ -493,7 +493,7 @@ impl SchedPool {
|
||||
|
||||
// Tell all existing schedulers about this new scheduler so they can all
|
||||
// steal work from it
|
||||
for handle in self.handles.mut_iter() {
|
||||
for handle in self.handles.iter_mut() {
|
||||
handle.send(NewNeighbor(stealer.clone()));
|
||||
}
|
||||
|
||||
@ -535,10 +535,10 @@ impl SchedPool {
|
||||
}
|
||||
|
||||
// Now that everyone's gone, tell everything to shut down.
|
||||
for mut handle in replace(&mut self.handles, vec![]).move_iter() {
|
||||
for mut handle in replace(&mut self.handles, vec![]).into_iter() {
|
||||
handle.send(Shutdown);
|
||||
}
|
||||
for thread in replace(&mut self.threads, vec![]).move_iter() {
|
||||
for thread in replace(&mut self.threads, vec![]).into_iter() {
|
||||
thread.join();
|
||||
}
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
|
||||
let root = unsafe { CString::new(root.as_ptr(), false) };
|
||||
let root = Path::new(root);
|
||||
|
||||
dirs.move_iter().filter(|path| {
|
||||
dirs.into_iter().filter(|path| {
|
||||
path.as_vec() != b"." && path.as_vec() != b".."
|
||||
}).map(|path| root.join(path).to_c_str()).collect()
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ impl FileDesc {
|
||||
let ret = unsafe {
|
||||
libc::ReadFile(self.handle(), buf.as_ptr() as libc::LPVOID,
|
||||
buf.len() as libc::DWORD, &mut read,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if ret != 0 {
|
||||
Ok(read as uint)
|
||||
@ -68,7 +68,7 @@ impl FileDesc {
|
||||
let ret = unsafe {
|
||||
libc::WriteFile(self.handle(), cur as libc::LPVOID,
|
||||
remaining as libc::DWORD, &mut amt,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if ret != 0 {
|
||||
remaining -= amt as uint;
|
||||
@ -313,10 +313,10 @@ pub fn open(path: &CString, fm: rtio::FileMode, fa: rtio::FileAccess)
|
||||
libc::CreateFileW(path.as_ptr(),
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if handle == libc::INVALID_HANDLE_VALUE {
|
||||
Err(super::last_error())
|
||||
@ -337,7 +337,7 @@ pub fn mkdir(p: &CString, _mode: uint) -> IoResult<()> {
|
||||
let p = try!(to_utf16(p));
|
||||
super::mkerr_winbool(unsafe {
|
||||
// FIXME: turn mode into something useful? #2623
|
||||
libc::CreateDirectoryW(p.as_ptr(), ptr::mut_null())
|
||||
libc::CreateDirectoryW(p.as_ptr(), ptr::null_mut())
|
||||
})
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ pub fn readdir(p: &CString) -> IoResult<Vec<CString>> {
|
||||
let root = unsafe { CString::new(root.as_ptr(), false) };
|
||||
let root = Path::new(root);
|
||||
|
||||
dirs.move_iter().filter(|path| {
|
||||
dirs.into_iter().filter(|path| {
|
||||
path.as_vec() != b"." && path.as_vec() != b".."
|
||||
}).map(|path| root.join(path).to_c_str()).collect()
|
||||
}
|
||||
@ -428,10 +428,10 @@ pub fn readlink(p: &CString) -> IoResult<CString> {
|
||||
libc::CreateFileW(p.as_ptr(),
|
||||
libc::GENERIC_READ,
|
||||
libc::FILE_SHARE_READ,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
libc::OPEN_EXISTING,
|
||||
libc::FILE_ATTRIBUTE_NORMAL,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if handle == libc::INVALID_HANDLE_VALUE {
|
||||
return Err(super::last_error())
|
||||
@ -468,7 +468,7 @@ pub fn link(src: &CString, dst: &CString) -> IoResult<()> {
|
||||
let src = try!(to_utf16(src));
|
||||
let dst = try!(to_utf16(dst));
|
||||
super::mkerr_winbool(unsafe {
|
||||
libc::CreateHardLinkW(dst.as_ptr(), src.as_ptr(), ptr::mut_null())
|
||||
libc::CreateHardLinkW(dst.as_ptr(), src.as_ptr(), ptr::null_mut())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ mod imp {
|
||||
|
||||
pub fn new() -> (HANDLE, HANDLE) {
|
||||
unsafe {
|
||||
let handle = CreateEventA(ptr::mut_null(), libc::FALSE, libc::FALSE,
|
||||
let handle = CreateEventA(ptr::null_mut(), libc::FALSE, libc::FALSE,
|
||||
ptr::null());
|
||||
(handle, handle)
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ impl rtio::IoFactory for IoFactory {
|
||||
Vec<Option<Box<rtio::RtioPipe + Send>>>)> {
|
||||
process::Process::spawn(cfg).map(|(p, io)| {
|
||||
(box p as Box<rtio::RtioProcess + Send>,
|
||||
io.move_iter().map(|p| p.map(|p| {
|
||||
io.into_iter().map(|p| p.map(|p| {
|
||||
box p as Box<rtio::RtioPipe + Send>
|
||||
})).collect())
|
||||
})
|
||||
|
@ -543,7 +543,7 @@ impl TcpAcceptor {
|
||||
|
||||
while !self.inner.closed.load(atomic::SeqCst) {
|
||||
match retry(|| unsafe {
|
||||
libc::accept(self.fd(), ptr::mut_null(), ptr::mut_null())
|
||||
libc::accept(self.fd(), ptr::null_mut(), ptr::null_mut())
|
||||
}) {
|
||||
-1 if util::wouldblock() => {}
|
||||
-1 => return Err(os::last_error()),
|
||||
@ -608,7 +608,7 @@ impl TcpAcceptor {
|
||||
|
||||
if wsaevents.lNetworkEvents & c::FD_ACCEPT == 0 { continue }
|
||||
match unsafe {
|
||||
libc::accept(self.fd(), ptr::mut_null(), ptr::mut_null())
|
||||
libc::accept(self.fd(), ptr::null_mut(), ptr::null_mut())
|
||||
} {
|
||||
-1 if util::wouldblock() => {}
|
||||
-1 => return Err(os::last_error()),
|
||||
|
@ -50,7 +50,7 @@ fn addr_to_sockaddr_un(addr: &CString,
|
||||
})
|
||||
}
|
||||
s.sun_family = libc::AF_UNIX as libc::sa_family_t;
|
||||
for (slot, value) in s.sun_path.mut_iter().zip(addr.iter()) {
|
||||
for (slot, value) in s.sun_path.iter_mut().zip(addr.iter()) {
|
||||
*slot = value;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ struct Event(libc::HANDLE);
|
||||
impl Event {
|
||||
fn new(manual_reset: bool, initial_state: bool) -> IoResult<Event> {
|
||||
let event = unsafe {
|
||||
libc::CreateEventW(ptr::mut_null(),
|
||||
libc::CreateEventW(ptr::null_mut(),
|
||||
manual_reset as libc::BOOL,
|
||||
initial_state as libc::BOOL,
|
||||
ptr::null())
|
||||
@ -164,7 +164,7 @@ unsafe fn pipe(name: *const u16, init: bool) -> libc::HANDLE {
|
||||
65536,
|
||||
65536,
|
||||
0,
|
||||
ptr::mut_null()
|
||||
ptr::null_mut()
|
||||
)
|
||||
}
|
||||
|
||||
@ -225,10 +225,10 @@ impl UnixStream {
|
||||
libc::CreateFileW(p,
|
||||
libc::GENERIC_READ | libc::GENERIC_WRITE,
|
||||
0,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
libc::OPEN_EXISTING,
|
||||
libc::FILE_FLAG_OVERLAPPED,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if result != libc::INVALID_HANDLE_VALUE {
|
||||
return Some(result)
|
||||
@ -240,10 +240,10 @@ impl UnixStream {
|
||||
libc::CreateFileW(p,
|
||||
libc::GENERIC_READ | libc::FILE_WRITE_ATTRIBUTES,
|
||||
0,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
libc::OPEN_EXISTING,
|
||||
libc::FILE_FLAG_OVERLAPPED,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if result != libc::INVALID_HANDLE_VALUE {
|
||||
return Some(result)
|
||||
@ -255,10 +255,10 @@ impl UnixStream {
|
||||
libc::CreateFileW(p,
|
||||
libc::GENERIC_WRITE | libc::FILE_READ_ATTRIBUTES,
|
||||
0,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
libc::OPEN_EXISTING,
|
||||
libc::FILE_FLAG_OVERLAPPED,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if result != libc::INVALID_HANDLE_VALUE {
|
||||
return Some(result)
|
||||
@ -280,8 +280,8 @@ impl UnixStream {
|
||||
let ret = unsafe {
|
||||
libc::SetNamedPipeHandleState(inner.handle,
|
||||
&mut mode,
|
||||
ptr::mut_null(),
|
||||
ptr::mut_null())
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut())
|
||||
};
|
||||
return if ret == 0 {
|
||||
Err(super::last_error())
|
||||
@ -341,7 +341,7 @@ impl UnixStream {
|
||||
}
|
||||
|
||||
fn cancel_io(&self) -> IoResult<()> {
|
||||
match unsafe { c::CancelIoEx(self.handle(), ptr::mut_null()) } {
|
||||
match unsafe { c::CancelIoEx(self.handle(), ptr::null_mut()) } {
|
||||
0 if os::errno() == libc::ERROR_NOT_FOUND as uint => {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
if b"PATH" != key.as_bytes_no_nul() { continue }
|
||||
|
||||
// Split the value and test each path to see if the program exists.
|
||||
for path in os::split_paths(v.as_bytes_no_nul()).move_iter() {
|
||||
for path in os::split_paths(v.as_bytes_no_nul()).into_iter() {
|
||||
let path = path.join(cfg.program.as_bytes_no_nul())
|
||||
.with_extension(os::consts::EXE_EXTENSION);
|
||||
if path.exists() {
|
||||
@ -347,7 +347,7 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
let size = mem::size_of::<libc::SECURITY_ATTRIBUTES>();
|
||||
let mut sa = libc::SECURITY_ATTRIBUTES {
|
||||
nLength: size as libc::DWORD,
|
||||
lpSecurityDescriptor: ptr::mut_null(),
|
||||
lpSecurityDescriptor: ptr::null_mut(),
|
||||
bInheritHandle: 1,
|
||||
};
|
||||
let filename: Vec<u16> = "NUL".utf16_units().collect();
|
||||
@ -359,7 +359,7 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
&mut sa,
|
||||
libc::OPEN_EXISTING,
|
||||
0,
|
||||
ptr::mut_null());
|
||||
ptr::null_mut());
|
||||
if *slot == INVALID_HANDLE_VALUE {
|
||||
return Err(super::last_error())
|
||||
}
|
||||
@ -399,8 +399,8 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
cmd_str = cmd_str.append_one(0);
|
||||
let created = CreateProcessW(ptr::null(),
|
||||
cmd_str.as_mut_ptr(),
|
||||
ptr::mut_null(),
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
TRUE,
|
||||
flags, envp, dirp,
|
||||
&mut si, &mut pi);
|
||||
@ -437,9 +437,9 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
fn zeroed_startupinfo() -> libc::types::os::arch::extra::STARTUPINFO {
|
||||
libc::types::os::arch::extra::STARTUPINFO {
|
||||
cb: 0,
|
||||
lpReserved: ptr::mut_null(),
|
||||
lpDesktop: ptr::mut_null(),
|
||||
lpTitle: ptr::mut_null(),
|
||||
lpReserved: ptr::null_mut(),
|
||||
lpDesktop: ptr::null_mut(),
|
||||
lpTitle: ptr::null_mut(),
|
||||
dwX: 0,
|
||||
dwY: 0,
|
||||
dwXSize: 0,
|
||||
@ -450,7 +450,7 @@ fn zeroed_startupinfo() -> libc::types::os::arch::extra::STARTUPINFO {
|
||||
dwFlags: 0,
|
||||
wShowWindow: 0,
|
||||
cbReserved2: 0,
|
||||
lpReserved2: ptr::mut_null(),
|
||||
lpReserved2: ptr::null_mut(),
|
||||
hStdInput: libc::INVALID_HANDLE_VALUE,
|
||||
hStdOutput: libc::INVALID_HANDLE_VALUE,
|
||||
hStdError: libc::INVALID_HANDLE_VALUE,
|
||||
@ -460,8 +460,8 @@ fn zeroed_startupinfo() -> libc::types::os::arch::extra::STARTUPINFO {
|
||||
#[cfg(windows)]
|
||||
fn zeroed_process_information() -> libc::types::os::arch::extra::PROCESS_INFORMATION {
|
||||
libc::types::os::arch::extra::PROCESS_INFORMATION {
|
||||
hProcess: ptr::mut_null(),
|
||||
hThread: ptr::mut_null(),
|
||||
hProcess: ptr::null_mut(),
|
||||
hThread: ptr::null_mut(),
|
||||
dwProcessId: 0,
|
||||
dwThreadId: 0
|
||||
}
|
||||
@ -596,7 +596,7 @@ fn spawn_process_os(cfg: ProcessConfig,
|
||||
Err(..) => {
|
||||
Ok(SpawnProcessResult {
|
||||
pid: pid,
|
||||
handle: ptr::mut_null()
|
||||
handle: ptr::null_mut()
|
||||
})
|
||||
}
|
||||
Ok(..) => fail!("short read on the cloexec pipe"),
|
||||
@ -806,7 +806,7 @@ fn with_envp<T>(env: Option<&[(&CString, &CString)]>, cb: |*mut c_void| -> T) ->
|
||||
|
||||
cb(blk.as_mut_ptr() as *mut c_void)
|
||||
}
|
||||
_ => cb(ptr::mut_null())
|
||||
_ => cb(ptr::null_mut())
|
||||
}
|
||||
}
|
||||
|
||||
@ -1050,14 +1050,14 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> {
|
||||
tv = util::ms_to_timeval(ms);
|
||||
(&mut tv as *mut _, idx)
|
||||
}
|
||||
None => (ptr::mut_null(), -1),
|
||||
None => (ptr::null_mut(), -1),
|
||||
};
|
||||
|
||||
// Wait for something to happen
|
||||
c::fd_set(&mut set, input);
|
||||
c::fd_set(&mut set, read_fd);
|
||||
match unsafe { c::select(max, &mut set, ptr::mut_null(),
|
||||
ptr::mut_null(), p) } {
|
||||
match unsafe { c::select(max, &mut set, ptr::null_mut(),
|
||||
ptr::null_mut(), p) } {
|
||||
// interrupted, retry
|
||||
-1 if os::errno() == libc::EINTR as int => continue,
|
||||
|
||||
@ -1129,7 +1129,7 @@ fn waitpid(pid: pid_t, deadline: u64) -> IoResult<rtio::ProcessExit> {
|
||||
// Once this helper thread is done, we re-register the old sigchld
|
||||
// handler and close our intermediate file descriptors.
|
||||
unsafe {
|
||||
assert_eq!(c::sigaction(c::SIGCHLD, &old, ptr::mut_null()), 0);
|
||||
assert_eq!(c::sigaction(c::SIGCHLD, &old, ptr::null_mut()), 0);
|
||||
let _ = libc::close(read_fd);
|
||||
let _ = libc::close(WRITE_FD);
|
||||
WRITE_FD = -1;
|
||||
|
@ -88,7 +88,7 @@ pub enum Req {
|
||||
pub fn now() -> u64 {
|
||||
unsafe {
|
||||
let mut now: libc::timeval = mem::zeroed();
|
||||
assert_eq!(c::gettimeofday(&mut now, ptr::mut_null()), 0);
|
||||
assert_eq!(c::gettimeofday(&mut now, ptr::null_mut()), 0);
|
||||
return (now.tv_sec as u64) * 1000 + (now.tv_usec as u64) / 1000;
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
|
||||
'outer: loop {
|
||||
let timeout = if active.len() == 0 {
|
||||
// Empty array? no timeout (wait forever for the next request)
|
||||
ptr::mut_null()
|
||||
ptr::null_mut()
|
||||
} else {
|
||||
let now = now();
|
||||
// If this request has already expired, then signal it and go
|
||||
@ -154,8 +154,8 @@ fn helper(input: libc::c_int, messages: Receiver<Req>, _: ()) {
|
||||
|
||||
c::fd_set(&mut set, input);
|
||||
match unsafe {
|
||||
c::select(input + 1, &mut set, ptr::mut_null(),
|
||||
ptr::mut_null(), timeout)
|
||||
c::select(input + 1, &mut set, ptr::null_mut(),
|
||||
ptr::null_mut(), timeout)
|
||||
} {
|
||||
// timed out
|
||||
0 => signal(&mut active, &mut dead),
|
||||
|
@ -107,7 +107,7 @@ impl Timer {
|
||||
unsafe { HELPER.boot(|| {}, helper) }
|
||||
|
||||
let obj = unsafe {
|
||||
imp::CreateWaitableTimerA(ptr::mut_null(), 0, ptr::null())
|
||||
imp::CreateWaitableTimerA(ptr::null_mut(), 0, ptr::null())
|
||||
};
|
||||
if obj.is_null() {
|
||||
Err(super::last_error())
|
||||
@ -141,8 +141,8 @@ impl rtio::RtioTimer for Timer {
|
||||
// 100ns intervals, so we multiply by 10^4.
|
||||
let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
|
||||
assert_eq!(unsafe {
|
||||
imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
|
||||
ptr::mut_null(), 0)
|
||||
imp::SetWaitableTimer(self.obj, &due, 0, ptr::null_mut(),
|
||||
ptr::null_mut(), 0)
|
||||
}, 1);
|
||||
|
||||
let _ = unsafe { imp::WaitForSingleObject(self.obj, libc::INFINITE) };
|
||||
@ -154,8 +154,8 @@ impl rtio::RtioTimer for Timer {
|
||||
// see above for the calculation
|
||||
let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
|
||||
assert_eq!(unsafe {
|
||||
imp::SetWaitableTimer(self.obj, &due, 0, ptr::mut_null(),
|
||||
ptr::mut_null(), 0)
|
||||
imp::SetWaitableTimer(self.obj, &due, 0, ptr::null_mut(),
|
||||
ptr::null_mut(), 0)
|
||||
}, 1);
|
||||
|
||||
unsafe { HELPER.send(NewTimer(self.obj, cb, true)) }
|
||||
@ -169,7 +169,7 @@ impl rtio::RtioTimer for Timer {
|
||||
let due = -(msecs as i64 * 10000) as libc::LARGE_INTEGER;
|
||||
assert_eq!(unsafe {
|
||||
imp::SetWaitableTimer(self.obj, &due, msecs as libc::LONG,
|
||||
ptr::mut_null(), ptr::mut_null(), 0)
|
||||
ptr::null_mut(), ptr::null_mut(), 0)
|
||||
}, 1);
|
||||
|
||||
unsafe { HELPER.send(NewTimer(self.obj, cb, false)) }
|
||||
|
@ -98,7 +98,7 @@ impl RtioTTY for WindowsTTY {
|
||||
utf16.as_mut_ptr() as LPVOID,
|
||||
utf16.len() as u32,
|
||||
&mut num as LPDWORD,
|
||||
ptr::mut_null()) } {
|
||||
ptr::null_mut()) } {
|
||||
0 => return Err(super::last_error()),
|
||||
_ => (),
|
||||
};
|
||||
@ -123,7 +123,7 @@ impl RtioTTY for WindowsTTY {
|
||||
utf16.as_ptr() as LPCVOID,
|
||||
utf16.len() as u32,
|
||||
&mut num as LPDWORD,
|
||||
ptr::mut_null()) } {
|
||||
ptr::null_mut()) } {
|
||||
0 => Err(super::last_error()),
|
||||
_ => Ok(()),
|
||||
}
|
||||
|
@ -155,15 +155,15 @@ pub fn connect_timeout(fd: net::sock_t,
|
||||
// undefined what the value of the 'tv' is after select
|
||||
// returns EINTR).
|
||||
let mut tv = ms_to_timeval(timeout - (::io::timer::now() - start));
|
||||
c::select(fd + 1, ptr::mut_null(), set as *mut _,
|
||||
ptr::mut_null(), &mut tv)
|
||||
c::select(fd + 1, ptr::null_mut(), set as *mut _,
|
||||
ptr::null_mut(), &mut tv)
|
||||
})
|
||||
}
|
||||
#[cfg(windows)]
|
||||
fn await(_fd: net::sock_t, set: &mut c::fd_set,
|
||||
timeout: u64) -> libc::c_int {
|
||||
let mut tv = ms_to_timeval(timeout);
|
||||
unsafe { c::select(1, ptr::mut_null(), set, ptr::mut_null(), &mut tv) }
|
||||
unsafe { c::select(1, ptr::null_mut(), set, ptr::null_mut(), &mut tv) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,15 +180,15 @@ pub fn await(fds: &[net::sock_t], deadline: Option<u64>,
|
||||
}
|
||||
|
||||
let (read, write) = match status {
|
||||
Readable => (&mut set as *mut _, ptr::mut_null()),
|
||||
Writable => (ptr::mut_null(), &mut set as *mut _),
|
||||
Readable => (&mut set as *mut _, ptr::null_mut()),
|
||||
Writable => (ptr::null_mut(), &mut set as *mut _),
|
||||
};
|
||||
let mut tv: libc::timeval = unsafe { mem::zeroed() };
|
||||
|
||||
match retry(|| {
|
||||
let now = ::io::timer::now();
|
||||
let tvp = match deadline {
|
||||
None => ptr::mut_null(),
|
||||
None => ptr::null_mut(),
|
||||
Some(deadline) => {
|
||||
// If we're past the deadline, then pass a 0 timeout to
|
||||
// select() so we can poll the status
|
||||
@ -198,7 +198,7 @@ pub fn await(fds: &[net::sock_t], deadline: Option<u64>,
|
||||
}
|
||||
};
|
||||
let r = unsafe {
|
||||
c::select(max as libc::c_int, read, write, ptr::mut_null(), tvp)
|
||||
c::select(max as libc::c_int, read, write, ptr::null_mut(), tvp)
|
||||
};
|
||||
r
|
||||
}) {
|
||||
|
@ -126,7 +126,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> {
|
||||
// we convert the list from individual weights to cumulative
|
||||
// weights so we can binary search. This *could* drop elements
|
||||
// with weight == 0 as an optimisation.
|
||||
for item in items.mut_iter() {
|
||||
for item in items.iter_mut() {
|
||||
running_total = match running_total.checked_add(&item.weight) {
|
||||
Some(n) => n,
|
||||
None => fail!("WeightedChoice::new called with a total weight \
|
||||
|
@ -207,7 +207,7 @@ impl<'a> SeedableRng<&'a [u32]> for IsaacRng {
|
||||
// - 1], 0, 0, ...], to fill rng.rsl.
|
||||
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u32));
|
||||
|
||||
for (rsl_elem, seed_elem) in self.rsl.mut_iter().zip(seed_iter) {
|
||||
for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
|
||||
*rsl_elem = seed_elem;
|
||||
}
|
||||
self.cnt = 0;
|
||||
@ -442,7 +442,7 @@ impl<'a> SeedableRng<&'a [u64]> for Isaac64Rng {
|
||||
// - 1], 0, 0, ...], to fill rng.rsl.
|
||||
let seed_iter = seed.iter().map(|&x| x).chain(Repeat::new(0u64));
|
||||
|
||||
for (rsl_elem, seed_elem) in self.rsl.mut_iter().zip(seed_iter) {
|
||||
for (rsl_elem, seed_elem) in self.rsl.iter_mut().zip(seed_iter) {
|
||||
*rsl_elem = seed_elem;
|
||||
}
|
||||
self.cnt = 0;
|
||||
|
@ -113,7 +113,7 @@ pub trait Rng {
|
||||
// optimisations are on.
|
||||
let mut count = 0i;
|
||||
let mut num = 0;
|
||||
for byte in dest.mut_iter() {
|
||||
for byte in dest.iter_mut() {
|
||||
if count == 0 {
|
||||
// we could micro-optimise here by generating a u32 if
|
||||
// we only need a few more bytes to fill the vector
|
||||
|
@ -102,7 +102,7 @@ impl Writer for SeekableMemWriter {
|
||||
|
||||
// Do the necessary writes
|
||||
if left.len() > 0 {
|
||||
slice::bytes::copy_memory(self.buf.mut_slice_from(self.pos), left);
|
||||
slice::bytes::copy_memory(self.buf.slice_from_mut(self.pos), left);
|
||||
}
|
||||
if right.len() > 0 {
|
||||
self.buf.push_all(right);
|
||||
|
@ -165,7 +165,7 @@ impl<'r> Compiler<'r> {
|
||||
self.push(Save(2 * cap + 1));
|
||||
}
|
||||
Cat(xs) => {
|
||||
for x in xs.move_iter() {
|
||||
for x in xs.into_iter() {
|
||||
self.compile(x)
|
||||
}
|
||||
}
|
||||
|
@ -418,13 +418,13 @@ impl<'a> Parser<'a> {
|
||||
if ranges.len() > 0 {
|
||||
let flags = negated | (self.flags & FLAG_NOCASE);
|
||||
let mut ast = Class(combine_ranges(ranges), flags);
|
||||
for alt in alts.move_iter() {
|
||||
for alt in alts.into_iter() {
|
||||
ast = Alt(box alt, box ast)
|
||||
}
|
||||
self.push(ast);
|
||||
} else if alts.len() > 0 {
|
||||
let mut ast = alts.pop().unwrap();
|
||||
for alt in alts.move_iter() {
|
||||
for alt in alts.into_iter() {
|
||||
ast = Alt(box alt, box ast)
|
||||
}
|
||||
self.push(ast);
|
||||
@ -961,7 +961,7 @@ fn combine_ranges(unordered: Vec<(char, char)>) -> Vec<(char, char)> {
|
||||
// This is currently O(n^2), but I think with sufficient cleverness,
|
||||
// it can be reduced to O(n) **if necessary**.
|
||||
let mut ordered: Vec<(char, char)> = Vec::with_capacity(unordered.len());
|
||||
for (us, ue) in unordered.move_iter() {
|
||||
for (us, ue) in unordered.into_iter() {
|
||||
let (mut us, mut ue) = (us, ue);
|
||||
assert!(us <= ue);
|
||||
let mut which: Option<uint> = None;
|
||||
|
@ -157,7 +157,7 @@ fn gen_text(n: uint) -> String {
|
||||
let mut rng = task_rng();
|
||||
let mut bytes = rng.gen_ascii_chars().map(|n| n as u8).take(n)
|
||||
.collect::<Vec<u8>>();
|
||||
for (i, b) in bytes.mut_iter().enumerate() {
|
||||
for (i, b) in bytes.iter_mut().enumerate() {
|
||||
if i % 20 == 0 {
|
||||
*b = b'\n'
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ impl<'r, 't> Nfa<'r, 't> {
|
||||
return StepMatch
|
||||
}
|
||||
Submatches => {
|
||||
for (slot, val) in groups.mut_iter().zip(caps.iter()) {
|
||||
for (slot, val) in groups.iter_mut().zip(caps.iter()) {
|
||||
*slot = *val;
|
||||
}
|
||||
return StepMatch
|
||||
@ -470,7 +470,7 @@ impl Threads {
|
||||
*t.groups.get_mut(1) = groups[1];
|
||||
}
|
||||
(false, Submatches) => {
|
||||
for (slot, val) in t.groups.mut_iter().zip(groups.iter()) {
|
||||
for (slot, val) in t.groups.iter_mut().zip(groups.iter()) {
|
||||
*slot = *val;
|
||||
}
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
|
||||
t.groups[1] = groups[1];
|
||||
}
|
||||
Submatches => {
|
||||
for (slot, val) in t.groups.mut_iter().zip(groups.iter()) {
|
||||
for (slot, val) in t.groups.iter_mut().zip(groups.iter()) {
|
||||
*slot = *val;
|
||||
}
|
||||
}
|
||||
@ -449,7 +449,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
|
||||
return StepMatch
|
||||
}
|
||||
Submatches => {
|
||||
for (slot, val) in groups.mut_iter().zip(caps.iter()) {
|
||||
for (slot, val) in groups.iter_mut().zip(caps.iter()) {
|
||||
*slot = *val;
|
||||
}
|
||||
return StepMatch
|
||||
|
@ -378,7 +378,7 @@ pub fn mangle_internal_name_by_type_and_seq(ccx: &CrateContext,
|
||||
}
|
||||
|
||||
pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> String {
|
||||
mangle(path.chain(Some(gensym_name(flav)).move_iter()), None)
|
||||
mangle(path.chain(Some(gensym_name(flav)).into_iter()), None)
|
||||
}
|
||||
|
||||
pub fn get_cc_prog(sess: &Session) -> String {
|
||||
@ -780,7 +780,7 @@ fn link_staticlib(sess: &Session, obj_filename: &Path, out_filename: &Path) {
|
||||
ab.add_rlib(&p, name.as_slice(), sess.lto()).unwrap();
|
||||
|
||||
let native_libs = csearch::get_native_libraries(&sess.cstore, cnum);
|
||||
all_native_libs.extend(native_libs.move_iter());
|
||||
all_native_libs.extend(native_libs.into_iter());
|
||||
}
|
||||
|
||||
ab.update_symbols();
|
||||
@ -1381,7 +1381,7 @@ fn add_upstream_native_libraries(cmd: &mut Command, sess: &Session) {
|
||||
// we're just getting an ordering of crate numbers, we're not worried about
|
||||
// the paths.
|
||||
let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
|
||||
for (cnum, _) in crates.move_iter() {
|
||||
for (cnum, _) in crates.into_iter() {
|
||||
let libs = csearch::get_native_libraries(&sess.cstore, cnum);
|
||||
for &(kind, ref lib) in libs.iter() {
|
||||
match kind {
|
||||
|
@ -46,7 +46,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
|
||||
// load the bitcode from the archive. Then merge it into the current LLVM
|
||||
// module that we've got.
|
||||
let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
|
||||
for (cnum, path) in crates.move_iter() {
|
||||
for (cnum, path) in crates.into_iter() {
|
||||
let name = sess.cstore.get_crate_data(cnum).name.clone();
|
||||
let path = match path {
|
||||
Some(p) => p,
|
||||
|
@ -857,7 +857,7 @@ fn run_work_multithreaded(sess: &Session,
|
||||
}
|
||||
|
||||
let mut failed = false;
|
||||
for future in futures.move_iter() {
|
||||
for future in futures.into_iter() {
|
||||
match future.unwrap() {
|
||||
Ok(()) => {},
|
||||
Err(_) => {
|
||||
|
@ -396,7 +396,7 @@ cgoptions!(
|
||||
pub fn build_codegen_options(matches: &getopts::Matches) -> CodegenOptions
|
||||
{
|
||||
let mut cg = basic_codegen_options();
|
||||
for option in matches.opt_strs("C").move_iter() {
|
||||
for option in matches.opt_strs("C").into_iter() {
|
||||
let mut iter = option.as_slice().splitn(1, '=');
|
||||
let key = iter.next().unwrap();
|
||||
let value = iter.next();
|
||||
@ -486,7 +486,7 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig {
|
||||
if sess.opts.test {
|
||||
append_configuration(&mut user_cfg, InternedString::new("test"))
|
||||
}
|
||||
user_cfg.move_iter().collect::<Vec<_>>().append(default_cfg.as_slice())
|
||||
user_cfg.into_iter().collect::<Vec<_>>().append(default_cfg.as_slice())
|
||||
}
|
||||
|
||||
pub fn get_os(triple: &str) -> Option<abi::Os> {
|
||||
@ -630,7 +630,7 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
|
||||
|
||||
// Convert strings provided as --cfg [cfgspec] into a crate_cfg
|
||||
fn parse_cfgspecs(cfgspecs: Vec<String> ) -> ast::CrateConfig {
|
||||
cfgspecs.move_iter().map(|s| {
|
||||
cfgspecs.into_iter().map(|s| {
|
||||
parse::parse_meta_from_source_str("cfgspec".to_string(),
|
||||
s.to_string(),
|
||||
Vec::new(),
|
||||
@ -652,7 +652,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
|
||||
let mut describe_lints = false;
|
||||
|
||||
for &level in [lint::Allow, lint::Warn, lint::Deny, lint::Forbid].iter() {
|
||||
for lint_name in matches.opt_strs(level.as_str()).move_iter() {
|
||||
for lint_name in matches.opt_strs(level.as_str()).into_iter() {
|
||||
if lint_name.as_slice() == "help" {
|
||||
describe_lints = true;
|
||||
} else {
|
||||
|
@ -237,11 +237,11 @@ pub fn phase_2_configure_and_expand(sess: &Session,
|
||||
|
||||
{
|
||||
let mut ls = sess.lint_store.borrow_mut();
|
||||
for pass in lint_passes.move_iter() {
|
||||
for pass in lint_passes.into_iter() {
|
||||
ls.register_pass(Some(sess), true, pass);
|
||||
}
|
||||
|
||||
for (name, to) in lint_groups.move_iter() {
|
||||
for (name, to) in lint_groups.into_iter() {
|
||||
ls.register_group(Some(sess), true, name, to);
|
||||
}
|
||||
}
|
||||
@ -701,7 +701,7 @@ pub fn collect_crate_types(session: &Session,
|
||||
// will be found in crate attributes.
|
||||
let mut base = session.opts.crate_types.clone();
|
||||
if base.len() == 0 {
|
||||
base.extend(attr_types.move_iter());
|
||||
base.extend(attr_types.into_iter());
|
||||
if base.len() == 0 {
|
||||
base.push(link::default_output_for_target(session));
|
||||
}
|
||||
@ -709,7 +709,7 @@ pub fn collect_crate_types(session: &Session,
|
||||
base.dedup();
|
||||
}
|
||||
|
||||
base.move_iter().filter(|crate_type| {
|
||||
base.into_iter().filter(|crate_type| {
|
||||
let res = !link::invalid_output_for_target(session, *crate_type);
|
||||
|
||||
if !res {
|
||||
|
@ -170,7 +170,7 @@ Available lint options:
|
||||
");
|
||||
|
||||
fn sort_lints(lints: Vec<(&'static Lint, bool)>) -> Vec<&'static Lint> {
|
||||
let mut lints: Vec<_> = lints.move_iter().map(|(x, _)| x).collect();
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, _)| x).collect();
|
||||
lints.sort_by(|x: &&Lint, y: &&Lint| {
|
||||
match x.default_level.cmp(&y.default_level) {
|
||||
// The sort doesn't case-fold but it's doubtful we care.
|
||||
@ -183,7 +183,7 @@ Available lint options:
|
||||
|
||||
fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
|
||||
-> Vec<(&'static str, Vec<lint::LintId>)> {
|
||||
let mut lints: Vec<_> = lints.move_iter().map(|(x, y, _)| (x, y)).collect();
|
||||
let mut lints: Vec<_> = lints.into_iter().map(|(x, y, _)| (x, y)).collect();
|
||||
lints.sort_by(|&(x, _): &(&'static str, Vec<lint::LintId>),
|
||||
&(y, _): &(&'static str, Vec<lint::LintId>)| {
|
||||
x.cmp(&y)
|
||||
@ -211,7 +211,7 @@ Available lint options:
|
||||
println!(" {} {:7.7s} {}", padded("----"), "-------", "-------");
|
||||
|
||||
let print_lints = |lints: Vec<&Lint>| {
|
||||
for lint in lints.move_iter() {
|
||||
for lint in lints.into_iter() {
|
||||
let name = lint.name_lower().replace("_", "-");
|
||||
println!(" {} {:7.7s} {}",
|
||||
padded(name.as_slice()), lint.default_level.as_str(), lint.desc);
|
||||
@ -235,10 +235,10 @@ Available lint options:
|
||||
println!(" {} {}", padded("----"), "---------");
|
||||
|
||||
let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
|
||||
for (name, to) in lints.move_iter() {
|
||||
for (name, to) in lints.into_iter() {
|
||||
let name = name.chars().map(|x| x.to_lowercase())
|
||||
.collect::<String>().replace("_", "-");
|
||||
let desc = to.move_iter().map(|x| x.as_str()).collect::<Vec<String>>().connect(", ");
|
||||
let desc = to.into_iter().map(|x| x.as_str()).collect::<Vec<String>>().connect(", ");
|
||||
println!(" {} {}",
|
||||
padded(name.as_slice()), desc);
|
||||
}
|
||||
@ -401,7 +401,7 @@ fn parse_crate_attrs(sess: &Session, input: &Input) ->
|
||||
&sess.parse_sess)
|
||||
}
|
||||
};
|
||||
result.move_iter().collect()
|
||||
result.into_iter().collect()
|
||||
}
|
||||
|
||||
pub fn early_error(msg: &str) -> ! {
|
||||
|
@ -342,7 +342,7 @@ impl UserIdentifiedItem {
|
||||
-> NodesMatchingUII<'a, 'ast> {
|
||||
match *self {
|
||||
ItemViaNode(node_id) =>
|
||||
NodesMatchingDirect(Some(node_id).move_iter()),
|
||||
NodesMatchingDirect(Some(node_id).into_iter()),
|
||||
ItemViaPath(ref parts) =>
|
||||
NodesMatchingSuffix(map.nodes_matching_suffix(parts.as_slice())),
|
||||
}
|
||||
|
@ -67,16 +67,16 @@ fn filter_view_item(cx: &mut Context, view_item: ast::ViewItem) -> Option<ast::V
|
||||
fn fold_mod(cx: &mut Context, ast::Mod {inner, view_items, items}: ast::Mod) -> ast::Mod {
|
||||
ast::Mod {
|
||||
inner: inner,
|
||||
view_items: view_items.move_iter().filter_map(|a| {
|
||||
view_items: view_items.into_iter().filter_map(|a| {
|
||||
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
|
||||
}).collect(),
|
||||
items: items.move_iter().filter_map(|a| {
|
||||
items: items.into_iter().filter_map(|a| {
|
||||
if item_in_cfg(cx, &*a) {
|
||||
Some(cx.fold_item(a))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}).flat_map(|x| x.move_iter()).collect()
|
||||
}).flat_map(|x| x.into_iter()).collect()
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,10 +93,10 @@ fn fold_foreign_mod(cx: &mut Context, ast::ForeignMod {abi, view_items, items}:
|
||||
-> ast::ForeignMod {
|
||||
ast::ForeignMod {
|
||||
abi: abi,
|
||||
view_items: view_items.move_iter().filter_map(|a| {
|
||||
view_items: view_items.into_iter().filter_map(|a| {
|
||||
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
|
||||
}).collect(),
|
||||
items: items.move_iter()
|
||||
items: items.into_iter()
|
||||
.filter_map(|a| filter_foreign_item(cx, a))
|
||||
.collect()
|
||||
}
|
||||
@ -105,13 +105,13 @@ fn fold_foreign_mod(cx: &mut Context, ast::ForeignMod {abi, view_items, items}:
|
||||
fn fold_item_underscore(cx: &mut Context, item: ast::Item_) -> ast::Item_ {
|
||||
let item = match item {
|
||||
ast::ItemImpl(a, b, c, impl_items) => {
|
||||
let impl_items = impl_items.move_iter()
|
||||
let impl_items = impl_items.into_iter()
|
||||
.filter(|ii| impl_item_in_cfg(cx, ii))
|
||||
.collect();
|
||||
ast::ItemImpl(a, b, c, impl_items)
|
||||
}
|
||||
ast::ItemTrait(a, b, c, methods) => {
|
||||
let methods = methods.move_iter()
|
||||
let methods = methods.into_iter()
|
||||
.filter(|m| trait_method_in_cfg(cx, m))
|
||||
.collect();
|
||||
ast::ItemTrait(a, b, c, methods)
|
||||
@ -120,7 +120,7 @@ fn fold_item_underscore(cx: &mut Context, item: ast::Item_) -> ast::Item_ {
|
||||
ast::ItemStruct(fold_struct(cx, def), generics)
|
||||
}
|
||||
ast::ItemEnum(def, generics) => {
|
||||
let mut variants = def.variants.move_iter().filter_map(|v| {
|
||||
let mut variants = def.variants.into_iter().filter_map(|v| {
|
||||
if !(cx.in_cfg)(v.node.attrs.as_slice()) {
|
||||
None
|
||||
} else {
|
||||
@ -158,7 +158,7 @@ fn fold_item_underscore(cx: &mut Context, item: ast::Item_) -> ast::Item_ {
|
||||
fn fold_struct(cx: &mut Context, def: P<ast::StructDef>) -> P<ast::StructDef> {
|
||||
def.map(|ast::StructDef {fields, ctor_id, super_struct, is_virtual}| {
|
||||
ast::StructDef {
|
||||
fields: fields.move_iter().filter(|m| {
|
||||
fields: fields.into_iter().filter(|m| {
|
||||
(cx.in_cfg)(m.node.attrs.as_slice())
|
||||
}).collect(),
|
||||
ctor_id: ctor_id,
|
||||
@ -185,11 +185,11 @@ fn retain_stmt(cx: &mut Context, stmt: &ast::Stmt) -> bool {
|
||||
fn fold_block(cx: &mut Context, b: P<ast::Block>) -> P<ast::Block> {
|
||||
b.map(|ast::Block {id, view_items, stmts, expr, rules, span}| {
|
||||
let resulting_stmts: Vec<P<ast::Stmt>> =
|
||||
stmts.move_iter().filter(|a| retain_stmt(cx, &**a)).collect();
|
||||
let resulting_stmts = resulting_stmts.move_iter()
|
||||
.flat_map(|stmt| cx.fold_stmt(stmt).move_iter())
|
||||
stmts.into_iter().filter(|a| retain_stmt(cx, &**a)).collect();
|
||||
let resulting_stmts = resulting_stmts.into_iter()
|
||||
.flat_map(|stmt| cx.fold_stmt(stmt).into_iter())
|
||||
.collect();
|
||||
let filtered_view_items = view_items.move_iter().filter_map(|a| {
|
||||
let filtered_view_items = view_items.into_iter().filter_map(|a| {
|
||||
filter_view_item(cx, a).map(|x| cx.fold_view_item(x))
|
||||
}).collect();
|
||||
ast::Block {
|
||||
@ -209,7 +209,7 @@ fn fold_expr(cx: &mut Context, expr: P<ast::Expr>) -> P<ast::Expr> {
|
||||
id: id,
|
||||
node: match node {
|
||||
ast::ExprMatch(m, arms) => {
|
||||
ast::ExprMatch(m, arms.move_iter()
|
||||
ast::ExprMatch(m, arms.into_iter()
|
||||
.filter(|a| (cx.in_cfg)(a.attrs.as_slice()))
|
||||
.collect())
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ impl<'a> fold::Folder for TestHarnessGenerator<'a> {
|
||||
ast::Item {
|
||||
id: id,
|
||||
ident: ident,
|
||||
attrs: attrs.move_iter().filter_map(|attr| {
|
||||
attrs: attrs.into_iter().filter_map(|attr| {
|
||||
if !attr.check_name("main") {
|
||||
Some(attr)
|
||||
} else {
|
||||
@ -195,11 +195,11 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
|
||||
let mut view_items = Vec::new();
|
||||
let super_ = token::str_to_ident("super");
|
||||
|
||||
view_items.extend(tests.move_iter().map(|r| {
|
||||
view_items.extend(tests.into_iter().map(|r| {
|
||||
cx.ext_cx.view_use_simple(DUMMY_SP, ast::Public,
|
||||
cx.ext_cx.path(DUMMY_SP, vec![super_, r]))
|
||||
}));
|
||||
view_items.extend(tested_submods.move_iter().map(|(r, sym)| {
|
||||
view_items.extend(tested_submods.into_iter().map(|(r, sym)| {
|
||||
let path = cx.ext_cx.path(DUMMY_SP, vec![super_, r, sym]);
|
||||
cx.ext_cx.view_use_simple_(DUMMY_SP, ast::Public, r, path)
|
||||
}));
|
||||
@ -444,7 +444,7 @@ fn path_node(ids: Vec<ast::Ident> ) -> ast::Path {
|
||||
ast::Path {
|
||||
span: DUMMY_SP,
|
||||
global: false,
|
||||
segments: ids.move_iter().map(|identifier| ast::PathSegment {
|
||||
segments: ids.into_iter().map(|identifier| ast::PathSegment {
|
||||
identifier: identifier,
|
||||
lifetimes: Vec::new(),
|
||||
types: OwnedSlice::empty(),
|
||||
@ -552,7 +552,7 @@ fn mk_test_desc_and_fn_rec(cx: &TestCtxt, test: &Test) -> P<ast::Expr> {
|
||||
);
|
||||
}
|
||||
};
|
||||
visible_path.extend(path.move_iter());
|
||||
visible_path.extend(path.into_iter());
|
||||
|
||||
let fn_expr = ecx.expr_path(ecx.path_global(span, visible_path));
|
||||
|
||||
|
@ -259,7 +259,7 @@ macro_rules! run_lints ( ($cx:expr, $f:ident, $($args:expr),*) => ({
|
||||
// Move the vector of passes out of `$cx` so that we can
|
||||
// iterate over it mutably while passing `$cx` to the methods.
|
||||
let mut passes = $cx.lints.passes.take().unwrap();
|
||||
for obj in passes.mut_iter() {
|
||||
for obj in passes.iter_mut() {
|
||||
obj.$f($cx, $($args),*);
|
||||
}
|
||||
$cx.lints.passes = Some(passes);
|
||||
@ -340,7 +340,7 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
|
||||
_ => sess.bug("impossible level in raw_emit_lint"),
|
||||
}
|
||||
|
||||
for span in note.move_iter() {
|
||||
for span in note.into_iter() {
|
||||
sess.span_note(span, "lint level defined here");
|
||||
}
|
||||
}
|
||||
@ -411,7 +411,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
// specified closure
|
||||
let mut pushed = 0u;
|
||||
|
||||
for result in gather_attrs(attrs).move_iter() {
|
||||
for result in gather_attrs(attrs).into_iter() {
|
||||
let v = match result {
|
||||
Err(span) => {
|
||||
self.tcx.sess.span_err(span, "malformed lint attribute");
|
||||
@ -438,7 +438,7 @@ impl<'a, 'tcx> Context<'a, 'tcx> {
|
||||
}
|
||||
};
|
||||
|
||||
for (lint_id, level, span) in v.move_iter() {
|
||||
for (lint_id, level, span) in v.into_iter() {
|
||||
let now = self.lints.get_level_source(lint_id).val0();
|
||||
if now == Forbid && level != Forbid {
|
||||
let lint_name = lint_id.as_str();
|
||||
@ -667,7 +667,7 @@ impl<'a, 'tcx> IdVisitingOperation for Context<'a, 'tcx> {
|
||||
match self.tcx.sess.lints.borrow_mut().pop(&id) {
|
||||
None => {}
|
||||
Some(lints) => {
|
||||
for (lint_id, span, msg) in lints.move_iter() {
|
||||
for (lint_id, span, msg) in lints.into_iter() {
|
||||
self.span_lint(lint_id.lint, span, msg.as_slice())
|
||||
}
|
||||
}
|
||||
|
@ -85,11 +85,11 @@ fn warn_if_multiple_versions(diag: &SpanHandler, cstore: &CStore) {
|
||||
map.find_or_insert_with(data.name(), |_| Vec::new()).push(cnum);
|
||||
});
|
||||
|
||||
for (name, dupes) in map.move_iter() {
|
||||
for (name, dupes) in map.into_iter() {
|
||||
if dupes.len() == 1 { continue }
|
||||
diag.handler().warn(
|
||||
format!("using multiple versions of crate `{}`", name).as_slice());
|
||||
for dupe in dupes.move_iter() {
|
||||
for dupe in dupes.into_iter() {
|
||||
let data = cstore.get_crate_data(dupe);
|
||||
diag.span_note(data.span, "used here");
|
||||
loader::note_crate_name(diag, data.name().as_slice());
|
||||
|
@ -1026,7 +1026,7 @@ fn get_meta_items(md: rbml::Doc) -> Vec<P<ast::MetaItem>> {
|
||||
let nd = reader::get_doc(meta_item_doc, tag_meta_item_name);
|
||||
let n = token::intern_and_get_ident(nd.as_str_slice());
|
||||
let subitems = get_meta_items(meta_item_doc);
|
||||
items.push(attr::mk_list_item(n, subitems.move_iter().collect()));
|
||||
items.push(attr::mk_list_item(n, subitems.into_iter().collect()));
|
||||
true
|
||||
});
|
||||
return items;
|
||||
@ -1044,7 +1044,7 @@ fn get_attributes(md: rbml::Doc) -> Vec<ast::Attribute> {
|
||||
// Currently it's only possible to have a single meta item on
|
||||
// an attribute
|
||||
assert_eq!(meta_items.len(), 1u);
|
||||
let meta_item = meta_items.move_iter().nth(0).unwrap();
|
||||
let meta_item = meta_items.into_iter().nth(0).unwrap();
|
||||
attrs.push(
|
||||
codemap::Spanned {
|
||||
node: ast::Attribute_ {
|
||||
|
@ -873,7 +873,7 @@ fn encode_info_for_method(ecx: &EncodeContext,
|
||||
encode_bounds_and_type(rbml_w, ecx, &pty);
|
||||
|
||||
let elem = ast_map::PathName(m.ident.name);
|
||||
encode_path(rbml_w, impl_path.chain(Some(elem).move_iter()));
|
||||
encode_path(rbml_w, impl_path.chain(Some(elem).into_iter()));
|
||||
match ast_item_opt {
|
||||
Some(&ast::MethodImplItem(ref ast_method)) => {
|
||||
encode_attributes(rbml_w, ast_method.attrs.as_slice());
|
||||
@ -1295,7 +1295,7 @@ fn encode_info_for_item(ecx: &EncodeContext,
|
||||
|
||||
let elem = ast_map::PathName(method_ty.ident.name);
|
||||
encode_path(rbml_w,
|
||||
path.clone().chain(Some(elem).move_iter()));
|
||||
path.clone().chain(Some(elem).into_iter()));
|
||||
|
||||
match method_ty.explicit_self {
|
||||
ty::StaticExplicitSelfCategory => {
|
||||
@ -1497,7 +1497,7 @@ fn encode_info_for_items(ecx: &EncodeContext,
|
||||
fn encode_index<T: Hash>(rbml_w: &mut Encoder, index: Vec<entry<T>>,
|
||||
write_fn: |&mut SeekableMemWriter, &T|) {
|
||||
let mut buckets: Vec<Vec<entry<T>>> = Vec::from_fn(256, |_| Vec::new());
|
||||
for elt in index.move_iter() {
|
||||
for elt in index.into_iter() {
|
||||
let h = hash::hash(&elt.val) as uint;
|
||||
buckets.get_mut(h % 256).push(elt);
|
||||
}
|
||||
@ -1913,7 +1913,7 @@ pub static metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't',
|
||||
pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
|
||||
let mut wr = SeekableMemWriter::new();
|
||||
encode_metadata_inner(&mut wr, parms, krate);
|
||||
wr.unwrap().move_iter().collect()
|
||||
wr.unwrap().into_iter().collect()
|
||||
}
|
||||
|
||||
fn encode_metadata_inner(wr: &mut SeekableMemWriter, parms: EncodeParams, krate: &Crate) {
|
||||
|
@ -449,7 +449,7 @@ impl<'a> Context<'a> {
|
||||
// libraries corresponds to the crate id and hash criteria that this
|
||||
// search is being performed for.
|
||||
let mut libraries = Vec::new();
|
||||
for (_hash, (rlibs, dylibs)) in candidates.move_iter() {
|
||||
for (_hash, (rlibs, dylibs)) in candidates.into_iter() {
|
||||
let mut metadata = None;
|
||||
let rlib = self.extract_one(rlibs, "rlib", &mut metadata);
|
||||
let dylib = self.extract_one(dylibs, "dylib", &mut metadata);
|
||||
@ -470,7 +470,7 @@ impl<'a> Context<'a> {
|
||||
// libraries or not.
|
||||
match libraries.len() {
|
||||
0 => None,
|
||||
1 => Some(libraries.move_iter().next().unwrap()),
|
||||
1 => Some(libraries.into_iter().next().unwrap()),
|
||||
_ => {
|
||||
self.sess.span_err(self.span,
|
||||
format!("multiple matching crates for `{}`",
|
||||
@ -521,11 +521,11 @@ impl<'a> Context<'a> {
|
||||
if m.len() == 0 {
|
||||
return None
|
||||
} else if m.len() == 1 {
|
||||
return Some(m.move_iter().next().unwrap())
|
||||
return Some(m.into_iter().next().unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
for lib in m.move_iter() {
|
||||
for lib in m.into_iter() {
|
||||
info!("{} reading metadata from: {}", flavor, lib.display());
|
||||
let metadata = match get_metadata_section(self.os, &lib) {
|
||||
Ok(blob) => {
|
||||
|
@ -330,7 +330,7 @@ struct NestedItemsDropper;
|
||||
impl Folder for NestedItemsDropper {
|
||||
fn fold_block(&mut self, blk: P<ast::Block>) -> P<ast::Block> {
|
||||
blk.and_then(|ast::Block {id, stmts, expr, rules, span, ..}| {
|
||||
let stmts_sans_items = stmts.move_iter().filter_map(|stmt| {
|
||||
let stmts_sans_items = stmts.into_iter().filter_map(|stmt| {
|
||||
let use_stmt = match stmt.node {
|
||||
ast::StmtExpr(_, _) | ast::StmtSemi(_, _) => true,
|
||||
ast::StmtDecl(ref decl, _) => {
|
||||
@ -810,7 +810,7 @@ impl<'a> vtable_decoder_helpers for reader::Decoder<'a> {
|
||||
tcx: &ty::ctxt, cdata: &cstore::crate_metadata)
|
||||
-> typeck::vtable_param_res {
|
||||
self.read_to_vec(|this| Ok(this.read_vtable_origin(tcx, cdata)))
|
||||
.unwrap().move_iter().collect()
|
||||
.unwrap().into_iter().collect()
|
||||
}
|
||||
|
||||
fn read_vtable_origin(&mut self,
|
||||
@ -1466,7 +1466,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
|
||||
cdata: &cstore::crate_metadata) -> Vec<ty::t> {
|
||||
self.read_to_vec(|this| Ok(this.read_ty_nodcx(tcx, cdata)) )
|
||||
.unwrap()
|
||||
.move_iter()
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
@ -1585,7 +1585,7 @@ impl<'a> rbml_decoder_decoder_helpers for reader::Decoder<'a> {
|
||||
}
|
||||
|
||||
fn read_tys(&mut self, dcx: &DecodeContext) -> Vec<ty::t> {
|
||||
self.read_to_vec(|this| Ok(this.read_ty(dcx))).unwrap().move_iter().collect()
|
||||
self.read_to_vec(|this| Ok(this.read_ty(dcx))).unwrap().into_iter().collect()
|
||||
}
|
||||
|
||||
fn read_trait_ref(&mut self, dcx: &DecodeContext) -> Rc<ty::TraitRef> {
|
||||
@ -1917,7 +1917,7 @@ fn decode_side_tables(dcx: &DecodeContext,
|
||||
c::tag_table_freevars => {
|
||||
let fv_info = val_dsr.read_to_vec(|val_dsr| {
|
||||
Ok(val_dsr.read_freevar_entry(dcx))
|
||||
}).unwrap().move_iter().collect();
|
||||
}).unwrap().into_iter().collect();
|
||||
dcx.tcx.freevars.borrow_mut().insert(id, fv_info);
|
||||
}
|
||||
c::tag_table_upvar_borrow_map => {
|
||||
|
@ -95,7 +95,7 @@ fn group_errors_with_same_origin(errors: &Vec<MoveError>)
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
for ge in grouped_errors.mut_iter() {
|
||||
for ge in grouped_errors.iter_mut() {
|
||||
if move_from_id == ge.move_from.id && error.move_to.is_some() {
|
||||
debug!("appending move_to to list");
|
||||
ge.move_to_places.push_all_move(move_to);
|
||||
|
@ -421,7 +421,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||
|
||||
ast::ExprIndex(ref l, ref r) |
|
||||
ast::ExprBinary(_, ref l, ref r) if self.is_method_call(expr) => {
|
||||
self.call(expr, pred, &**l, Some(&**r).move_iter())
|
||||
self.call(expr, pred, &**l, Some(&**r).into_iter())
|
||||
}
|
||||
|
||||
ast::ExprUnary(_, ref e) if self.is_method_call(expr) => {
|
||||
@ -461,7 +461,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||
ast::ExprParen(ref e) |
|
||||
ast::ExprField(ref e, _, _) |
|
||||
ast::ExprTupField(ref e, _, _) => {
|
||||
self.straightline(expr, pred, Some(&**e).move_iter())
|
||||
self.straightline(expr, pred, Some(&**e).into_iter())
|
||||
}
|
||||
|
||||
ast::ExprInlineAsm(ref inline_asm) => {
|
||||
|
@ -72,9 +72,9 @@ impl<'a> fmt::Show for Matrix<'a> {
|
||||
let total_width = column_widths.iter().map(|n| *n).sum() + column_count * 3 + 1;
|
||||
let br = String::from_char(total_width, '+');
|
||||
try!(write!(f, "{}\n", br));
|
||||
for row in pretty_printed_matrix.move_iter() {
|
||||
for row in pretty_printed_matrix.into_iter() {
|
||||
try!(write!(f, "+"));
|
||||
for (column, pat_str) in row.move_iter().enumerate() {
|
||||
for (column, pat_str) in row.into_iter().enumerate() {
|
||||
try!(write!(f, " "));
|
||||
f.width = Some(*column_widths.get(column));
|
||||
try!(f.pad(pat_str.as_slice()));
|
||||
@ -369,7 +369,7 @@ impl<'a, 'tcx> Folder for StaticInliner<'a, 'tcx> {
|
||||
fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
|
||||
pats: Vec<&Pat>, left_ty: ty::t) -> P<Pat> {
|
||||
let pats_len = pats.len();
|
||||
let mut pats = pats.move_iter().map(|p| P((*p).clone()));
|
||||
let mut pats = pats.into_iter().map(|p| P((*p).clone()));
|
||||
let pat = match ty::get(left_ty).sty {
|
||||
ty::ty_tup(_) => PatTup(pats.collect()),
|
||||
|
||||
@ -383,7 +383,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
|
||||
};
|
||||
if is_structure {
|
||||
let fields = ty::lookup_struct_fields(cx.tcx, vid);
|
||||
let field_pats: Vec<FieldPat> = fields.move_iter()
|
||||
let field_pats: Vec<FieldPat> = fields.into_iter()
|
||||
.zip(pats)
|
||||
.filter(|&(_, ref pat)| pat.node != PatWild(PatWildSingle))
|
||||
.map(|(field, pat)| FieldPat {
|
||||
@ -450,10 +450,10 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
|
||||
fn missing_constructor(cx: &MatchCheckCtxt, &Matrix(ref rows): &Matrix,
|
||||
left_ty: ty::t, max_slice_length: uint) -> Option<Constructor> {
|
||||
let used_constructors: Vec<Constructor> = rows.iter()
|
||||
.flat_map(|row| pat_constructors(cx, *row.get(0), left_ty, max_slice_length).move_iter())
|
||||
.flat_map(|row| pat_constructors(cx, *row.get(0), left_ty, max_slice_length).into_iter())
|
||||
.collect();
|
||||
all_constructors(cx, left_ty, max_slice_length)
|
||||
.move_iter()
|
||||
.into_iter()
|
||||
.find(|c| !used_constructors.contains(c))
|
||||
}
|
||||
|
||||
@ -536,7 +536,7 @@ fn is_useful(cx: &MatchCheckCtxt,
|
||||
if constructors.is_empty() {
|
||||
match missing_constructor(cx, matrix, left_ty, max_slice_length) {
|
||||
None => {
|
||||
all_constructors(cx, left_ty, max_slice_length).move_iter().map(|c| {
|
||||
all_constructors(cx, left_ty, max_slice_length).into_iter().map(|c| {
|
||||
match is_useful_specialized(cx, matrix, v, c.clone(), left_ty, witness) {
|
||||
UsefulWithWitness(pats) => UsefulWithWitness({
|
||||
let arity = constructor_arity(cx, &c, left_ty);
|
||||
@ -547,7 +547,7 @@ fn is_useful(cx: &MatchCheckCtxt,
|
||||
});
|
||||
vec![construct_witness(cx, &c, subpats, left_ty)]
|
||||
};
|
||||
result.extend(pats.move_iter().skip(arity));
|
||||
result.extend(pats.into_iter().skip(arity));
|
||||
result
|
||||
}),
|
||||
result => result
|
||||
@ -569,7 +569,7 @@ fn is_useful(cx: &MatchCheckCtxt,
|
||||
let wild_pats = Vec::from_elem(arity, &DUMMY_WILD_PAT);
|
||||
let enum_pat = construct_witness(cx, &constructor, wild_pats, left_ty);
|
||||
let mut new_pats = vec![enum_pat];
|
||||
new_pats.extend(pats.move_iter());
|
||||
new_pats.extend(pats.into_iter());
|
||||
UsefulWithWitness(new_pats)
|
||||
},
|
||||
result => result
|
||||
@ -577,7 +577,7 @@ fn is_useful(cx: &MatchCheckCtxt,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
constructors.move_iter().map(|c|
|
||||
constructors.into_iter().map(|c|
|
||||
is_useful_specialized(cx, matrix, v, c.clone(), left_ty, witness)
|
||||
).find(|result| result != &NotUseful).unwrap_or(NotUseful)
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
|
||||
let cfgidx = to_cfgidx_or_die(id, &self.nodeid_to_index);
|
||||
let (start, end) = self.compute_id_range(cfgidx);
|
||||
let gens = self.gens.mut_slice(start, end);
|
||||
let gens = self.gens.slice_mut(start, end);
|
||||
set_bit(gens, bit);
|
||||
}
|
||||
|
||||
@ -242,7 +242,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
|
||||
let cfgidx = to_cfgidx_or_die(id, &self.nodeid_to_index);
|
||||
let (start, end) = self.compute_id_range(cfgidx);
|
||||
let kills = self.kills.mut_slice(start, end);
|
||||
let kills = self.kills.slice_mut(start, end);
|
||||
set_bit(kills, bit);
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
|
||||
}
|
||||
|
||||
if changed {
|
||||
let bits = self.kills.mut_slice(start, end);
|
||||
let bits = self.kills.slice_mut(start, end);
|
||||
debug!("{:s} add_kills_from_flow_exits flow_exit={} bits={} [before]",
|
||||
self.analysis_name, flow_exit, mut_bits_to_string(bits));
|
||||
bits.copy_from(orig_kills.as_slice());
|
||||
@ -498,7 +498,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
||||
|
||||
fn reset(&mut self, bits: &mut [uint]) {
|
||||
let e = if self.dfcx.oper.initial_value() {uint::MAX} else {0};
|
||||
for b in bits.mut_iter() {
|
||||
for b in bits.iter_mut() {
|
||||
*b = e;
|
||||
}
|
||||
}
|
||||
@ -525,7 +525,7 @@ impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
|
||||
let (start, end) = self.dfcx.compute_id_range(cfgidx);
|
||||
let changed = {
|
||||
// (scoping mutable borrow of self.dfcx.on_entry)
|
||||
let on_entry = self.dfcx.on_entry.mut_slice(start, end);
|
||||
let on_entry = self.dfcx.on_entry.slice_mut(start, end);
|
||||
bitwise(on_entry, pred_bits, &self.dfcx.oper)
|
||||
};
|
||||
if changed {
|
||||
@ -566,7 +566,7 @@ fn bitwise<Op:BitwiseOperator>(out_vec: &mut [uint],
|
||||
op: &Op) -> bool {
|
||||
assert_eq!(out_vec.len(), in_vec.len());
|
||||
let mut changed = false;
|
||||
for (out_elt, in_elt) in out_vec.mut_iter().zip(in_vec.iter()) {
|
||||
for (out_elt, in_elt) in out_vec.iter_mut().zip(in_vec.iter()) {
|
||||
let old_val = *out_elt;
|
||||
let new_val = op.join(old_val, *in_elt);
|
||||
*out_elt = new_val;
|
||||
|
@ -302,7 +302,7 @@ fn has_allow_dead_code_or_lang_attr(attrs: &[ast::Attribute]) -> bool {
|
||||
}
|
||||
|
||||
let dead_code = lint::builtin::DEAD_CODE.name_lower();
|
||||
for attr in lint::gather_attrs(attrs).move_iter() {
|
||||
for attr in lint::gather_attrs(attrs).into_iter() {
|
||||
match attr {
|
||||
Ok((ref name, lint::Allow, _))
|
||||
if name.get() == dead_code.as_slice() => return true,
|
||||
|
@ -224,7 +224,7 @@ fn add_library(sess: &session::Session,
|
||||
fn attempt_static(sess: &session::Session) -> Option<DependencyList> {
|
||||
let crates = sess.cstore.get_used_crates(cstore::RequireStatic);
|
||||
if crates.iter().all(|&(_, ref p)| p.is_some()) {
|
||||
Some(crates.move_iter().map(|_| Some(cstore::RequireStatic)).collect())
|
||||
Some(crates.into_iter().map(|_| Some(cstore::RequireStatic)).collect())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ pub fn def_to_path(tcx: &ty::ctxt, id: DefId) -> Path {
|
||||
identifier: Ident::new(elem.name()),
|
||||
lifetimes: vec!(),
|
||||
types: OwnedSlice::empty()
|
||||
}).move_iter().collect(),
|
||||
}).into_iter().collect(),
|
||||
span: DUMMY_SP,
|
||||
})
|
||||
}
|
||||
|
@ -6045,7 +6045,7 @@ impl<'a> Resolver<'a> {
|
||||
if idents.len() == 0 {
|
||||
return "???".to_string();
|
||||
}
|
||||
self.idents_to_string(idents.move_iter().rev()
|
||||
self.idents_to_string(idents.into_iter().rev()
|
||||
.collect::<Vec<ast::Ident>>()
|
||||
.as_slice())
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ impl<T> HomogeneousTuple3<T> for (T, T, T) {
|
||||
}
|
||||
|
||||
fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
|
||||
self.as_mut_slice().mut_iter()
|
||||
self.as_mut_slice().iter_mut()
|
||||
}
|
||||
|
||||
fn get<'a>(&'a self, index: uint) -> Option<&'a T> {
|
||||
@ -350,7 +350,7 @@ impl<T> VecPerParamSpace<T> {
|
||||
|
||||
pub fn sort(t: Vec<T>, space: |&T| -> ParamSpace) -> VecPerParamSpace<T> {
|
||||
let mut result = VecPerParamSpace::empty();
|
||||
for t in t.move_iter() {
|
||||
for t in t.into_iter() {
|
||||
result.push(space(&t), t);
|
||||
}
|
||||
result
|
||||
@ -394,7 +394,7 @@ impl<T> VecPerParamSpace<T> {
|
||||
pub fn replace(&mut self, space: ParamSpace, elems: Vec<T>) {
|
||||
// FIXME (#15435): slow; O(n^2); could enhance vec to make it O(n).
|
||||
self.truncate(space, 0);
|
||||
for t in elems.move_iter() {
|
||||
for t in elems.into_iter() {
|
||||
self.push(space, t);
|
||||
}
|
||||
}
|
||||
@ -420,7 +420,7 @@ impl<T> VecPerParamSpace<T> {
|
||||
|
||||
pub fn get_mut_slice<'a>(&'a mut self, space: ParamSpace) -> &'a mut [T] {
|
||||
let (start, limit) = self.limits(space);
|
||||
self.content.mut_slice(start, limit)
|
||||
self.content.slice_mut(start, limit)
|
||||
}
|
||||
|
||||
pub fn opt_get<'a>(&'a self,
|
||||
@ -471,9 +471,9 @@ impl<T> VecPerParamSpace<T> {
|
||||
|
||||
pub fn map_move<U>(self, pred: |T| -> U) -> VecPerParamSpace<U> {
|
||||
let (t, s, f) = self.split();
|
||||
VecPerParamSpace::new(t.move_iter().map(|p| pred(p)).collect(),
|
||||
s.move_iter().map(|p| pred(p)).collect(),
|
||||
f.move_iter().map(|p| pred(p)).collect())
|
||||
VecPerParamSpace::new(t.into_iter().map(|p| pred(p)).collect(),
|
||||
s.into_iter().map(|p| pred(p)).collect(),
|
||||
f.into_iter().map(|p| pred(p)).collect())
|
||||
}
|
||||
|
||||
pub fn map_rev<U>(&self, pred: |&T| -> U) -> VecPerParamSpace<U> {
|
||||
|
@ -142,7 +142,7 @@ impl FulfillmentContext {
|
||||
|
||||
// Now go through all the successful ones,
|
||||
// registering any nested obligations for the future.
|
||||
for selection in selections.move_iter() {
|
||||
for selection in selections.into_iter() {
|
||||
selection.map_move_nested(
|
||||
|o| self.register_obligation(tcx, o));
|
||||
}
|
||||
@ -247,4 +247,3 @@ impl FulfillmentContext {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1735,7 +1735,7 @@ fn bind_irrefutable_pat<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
.iter()
|
||||
.chain(slice.iter())
|
||||
.chain(after.iter())
|
||||
.zip(extracted.vals.move_iter())
|
||||
.zip(extracted.vals.into_iter())
|
||||
.fold(bcx, |bcx, (inner, elem)|
|
||||
bind_irrefutable_pat(bcx, &**inner, elem, binding_mode, cleanup_scope)
|
||||
);
|
||||
|
@ -80,7 +80,7 @@ pub fn trans_inline_asm<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, ia: &ast::InlineAsm)
|
||||
let mut constraints =
|
||||
String::from_str(constraints.iter()
|
||||
.map(|s| s.get().to_string())
|
||||
.chain(ext_constraints.move_iter())
|
||||
.chain(ext_constraints.into_iter())
|
||||
.collect::<Vec<String>>()
|
||||
.connect(",")
|
||||
.as_slice());
|
||||
|
@ -1631,7 +1631,7 @@ fn copy_args_to_allocas<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
|
||||
|
||||
let arg_scope_id = cleanup::CustomScope(arg_scope);
|
||||
|
||||
for (i, arg_datum) in arg_datums.move_iter().enumerate() {
|
||||
for (i, arg_datum) in arg_datums.into_iter().enumerate() {
|
||||
// For certain mode/type combinations, the raw llarg values are passed
|
||||
// by value. However, within the fn body itself, we want to always
|
||||
// have all locals and arguments be by-ref so that we can cancel the
|
||||
@ -1662,7 +1662,7 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
|
||||
|
||||
assert_eq!(arg_datums.len(), 1);
|
||||
|
||||
let arg_datum = arg_datums.move_iter().next().unwrap();
|
||||
let arg_datum = arg_datums.into_iter().next().unwrap();
|
||||
|
||||
// Untuple the rest of the arguments.
|
||||
let tuple_datum =
|
||||
@ -2062,7 +2062,7 @@ fn trans_enum_variant_or_tuple_like_struct(ccx: &CrateContext,
|
||||
if !type_is_zero_size(fcx.ccx, result_ty) {
|
||||
let dest = fcx.get_ret_slot(bcx, result_ty, "eret_slot");
|
||||
let repr = adt::represent_type(ccx, result_ty);
|
||||
for (i, arg_datum) in arg_datums.move_iter().enumerate() {
|
||||
for (i, arg_datum) in arg_datums.into_iter().enumerate() {
|
||||
let lldestptr = adt::trans_field_ptr(bcx,
|
||||
&*repr,
|
||||
dest,
|
||||
@ -3133,7 +3133,7 @@ pub fn trans_crate<'tcx>(analysis: CrateAnalysis<'tcx>)
|
||||
// the final product, so LTO needs to preserve them.
|
||||
shared_ccx.sess().cstore.iter_crate_data(|cnum, _| {
|
||||
let syms = csearch::get_reachable_extern_fns(&shared_ccx.sess().cstore, cnum);
|
||||
reachable.extend(syms.move_iter().map(|did| {
|
||||
reachable.extend(syms.into_iter().map(|did| {
|
||||
csearch::get_symbol(&shared_ccx.sess().cstore, did)
|
||||
}));
|
||||
});
|
||||
|
@ -547,7 +547,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
// we care about.
|
||||
if ixs.len() < 16 {
|
||||
let mut small_vec = [ C_i32(self.ccx, 0), ..16 ];
|
||||
for (small_vec_e, &ix) in small_vec.mut_iter().zip(ixs.iter()) {
|
||||
for (small_vec_e, &ix) in small_vec.iter_mut().zip(ixs.iter()) {
|
||||
*small_vec_e = C_i32(self.ccx, ix as i32);
|
||||
}
|
||||
self.inbounds_gep(base, small_vec.slice(0, ixs.len()))
|
||||
|
@ -145,7 +145,7 @@ fn classify_ty(ty: Type) -> Vec<RegClass> {
|
||||
}
|
||||
|
||||
fn all_mem(cls: &mut [RegClass]) {
|
||||
for elt in cls.mut_iter() {
|
||||
for elt in cls.iter_mut() {
|
||||
*elt = Memory;
|
||||
}
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
|
||||
debug!("schedule_clean_in_ast_scope(cleanup_scope={:?})",
|
||||
cleanup_scope);
|
||||
|
||||
for scope in self.scopes.borrow_mut().mut_iter().rev() {
|
||||
for scope in self.scopes.borrow_mut().iter_mut().rev() {
|
||||
if scope.kind.is_ast_with_id(cleanup_scope) {
|
||||
scope.cleanups.push(cleanup);
|
||||
scope.clear_cached_exits();
|
||||
@ -712,7 +712,7 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
|
||||
// Check if a landing pad block exists; if not, create one.
|
||||
{
|
||||
let mut scopes = self.scopes.borrow_mut();
|
||||
let last_scope = scopes.mut_last().unwrap();
|
||||
let last_scope = scopes.last_mut().unwrap();
|
||||
match last_scope.cached_landing_pad {
|
||||
Some(llbb) => { return llbb; }
|
||||
None => {
|
||||
|
@ -197,7 +197,7 @@ pub fn store_environment<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
|
||||
// Copy expr values into boxed bindings.
|
||||
let mut bcx = bcx;
|
||||
for (i, bv) in bound_values.move_iter().enumerate() {
|
||||
for (i, bv) in bound_values.into_iter().enumerate() {
|
||||
debug!("Copy {} into closure", bv.to_string(ccx));
|
||||
|
||||
if ccx.sess().asm_comments() {
|
||||
|
@ -422,8 +422,8 @@ impl LocalCrateContext {
|
||||
adt_reprs: RefCell::new(HashMap::new()),
|
||||
type_hashcodes: RefCell::new(HashMap::new()),
|
||||
all_llvm_symbols: RefCell::new(HashSet::new()),
|
||||
int_type: Type::from_ref(ptr::mut_null()),
|
||||
opaque_vec_type: Type::from_ref(ptr::mut_null()),
|
||||
int_type: Type::from_ref(ptr::null_mut()),
|
||||
opaque_vec_type: Type::from_ref(ptr::null_mut()),
|
||||
builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
|
||||
unboxed_closure_vals: RefCell::new(DefIdMap::new()),
|
||||
dbg_cx: dbg_cx,
|
||||
|
@ -822,7 +822,7 @@ pub fn create_global_var_metadata(cx: &CrateContext,
|
||||
type_metadata,
|
||||
is_local_to_unit,
|
||||
global,
|
||||
ptr::mut_null());
|
||||
ptr::null_mut());
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -1014,7 +1014,7 @@ pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
|
||||
}
|
||||
};
|
||||
|
||||
if unsafe { llvm::LLVMIsAAllocaInst(llarg.val) } == ptr::mut_null() {
|
||||
if unsafe { llvm::LLVMIsAAllocaInst(llarg.val) } == ptr::null_mut() {
|
||||
cx.sess().span_bug(span, "debuginfo::create_argument_metadata() - \
|
||||
Referenced variable location is not an alloca!");
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
||||
cx.sess().opts.optimize != config::No,
|
||||
llfn,
|
||||
template_parameters,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
}
|
||||
})
|
||||
});
|
||||
@ -1308,7 +1308,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
||||
// Return type -- llvm::DIBuilder wants this at index 0
|
||||
match fn_decl.output.node {
|
||||
ast::TyNil => {
|
||||
signature.push(ptr::mut_null());
|
||||
signature.push(ptr::null_mut());
|
||||
}
|
||||
_ => {
|
||||
assert_type_for_node_id(cx, fn_ast_id, error_span);
|
||||
@ -1382,7 +1382,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
||||
file_metadata,
|
||||
name,
|
||||
actual_self_type_metadata,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
0,
|
||||
0)
|
||||
}
|
||||
@ -1417,7 +1417,7 @@ pub fn create_function_debug_context(cx: &CrateContext,
|
||||
file_metadata,
|
||||
name,
|
||||
actual_type_metadata,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
0,
|
||||
0)
|
||||
}
|
||||
@ -2410,7 +2410,7 @@ fn prepare_enum_metadata(cx: &CrateContext,
|
||||
bytes_to_bits(enum_type_size),
|
||||
bytes_to_bits(enum_type_align),
|
||||
0, // Flags
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
0, // RuntimeLang
|
||||
unique_type_id_str)
|
||||
}
|
||||
@ -2581,10 +2581,10 @@ fn create_struct_stub(cx: &CrateContext,
|
||||
bytes_to_bits(struct_size),
|
||||
bytes_to_bits(struct_align),
|
||||
0,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
empty_array,
|
||||
0,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
unique_type_id)
|
||||
})
|
||||
})
|
||||
@ -2798,7 +2798,7 @@ fn subroutine_type_metadata(cx: &CrateContext,
|
||||
|
||||
// return type
|
||||
signature_metadata.push(match ty::get(signature.output).sty {
|
||||
ty::ty_nil => ptr::mut_null(),
|
||||
ty::ty_nil => ptr::null_mut(),
|
||||
_ => type_metadata(cx, signature.output, span)
|
||||
});
|
||||
|
||||
@ -3074,7 +3074,7 @@ fn set_debug_location(cx: &CrateContext, debug_location: DebugLocation) {
|
||||
let col = UNKNOWN_COLUMN_NUMBER;
|
||||
debug!("setting debug location to {} {}", line, col);
|
||||
let elements = [C_i32(cx, line as i32), C_i32(cx, col as i32),
|
||||
scope, ptr::mut_null()];
|
||||
scope, ptr::null_mut()];
|
||||
unsafe {
|
||||
metadata_node = llvm::LLVMMDNodeInContext(debug_context(cx).llcontext,
|
||||
elements.as_ptr(),
|
||||
@ -3083,7 +3083,7 @@ fn set_debug_location(cx: &CrateContext, debug_location: DebugLocation) {
|
||||
}
|
||||
UnknownLocation => {
|
||||
debug!("clearing debug location ");
|
||||
metadata_node = ptr::mut_null();
|
||||
metadata_node = ptr::null_mut();
|
||||
}
|
||||
};
|
||||
|
||||
@ -3953,7 +3953,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut path = krate.move_iter().chain(path).peekable();
|
||||
let mut path = krate.into_iter().chain(path).peekable();
|
||||
|
||||
let mut current_key = Vec::new();
|
||||
let mut parent_node: Option<Rc<NamespaceTreeNode>> = None;
|
||||
@ -3981,7 +3981,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
|
||||
// create and insert
|
||||
let parent_scope = match parent_node {
|
||||
Some(ref node) => node.scope,
|
||||
None => ptr::mut_null()
|
||||
None => ptr::null_mut()
|
||||
};
|
||||
let namespace_name = token::get_name(name);
|
||||
let scope = namespace_name.get().with_c_str(|namespace_name| {
|
||||
@ -3991,7 +3991,7 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
|
||||
parent_scope,
|
||||
namespace_name,
|
||||
// cannot reconstruct file ...
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
// ... or line information, but that's not so important.
|
||||
0)
|
||||
}
|
||||
|
@ -618,7 +618,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
|
||||
|
||||
let ps = ccx.tcx().map.with_path(id, |path| {
|
||||
let abi = Some(ast_map::PathName(special_idents::clownshoe_abi.name));
|
||||
link::mangle(path.chain(abi.move_iter()), hash)
|
||||
link::mangle(path.chain(abi.into_iter()), hash)
|
||||
});
|
||||
|
||||
// Compute the type that the function would have if it were just a
|
||||
|
@ -560,7 +560,7 @@ pub fn get_vtable(bcx: Block,
|
||||
impl_def_id: id,
|
||||
substs: substs,
|
||||
nested: _ }) => {
|
||||
emit_vtable_methods(bcx, id, substs).move_iter()
|
||||
emit_vtable_methods(bcx, id, substs).into_iter()
|
||||
}
|
||||
traits::VtableUnboxedClosure(closure_def_id) => {
|
||||
let callee_substs =
|
||||
@ -626,7 +626,7 @@ pub fn get_vtable(bcx: Block,
|
||||
}
|
||||
}
|
||||
|
||||
(vec!(llfn)).move_iter()
|
||||
(vec!(llfn)).into_iter()
|
||||
}
|
||||
traits::VtableBuiltin |
|
||||
traits::VtableParam(..) => {
|
||||
@ -662,7 +662,7 @@ pub fn make_vtable<I: Iterator<ValueRef>>(ccx: &CrateContext,
|
||||
let _icx = push_ctxt("meth::make_vtable");
|
||||
|
||||
let head = vec![drop_glue, size, align];
|
||||
let components: Vec<_> = head.move_iter().chain(ptrs).collect();
|
||||
let components: Vec<_> = head.into_iter().chain(ptrs).collect();
|
||||
|
||||
unsafe {
|
||||
let tbl = C_struct(ccx, components.as_slice(), false);
|
||||
|
@ -4488,7 +4488,7 @@ pub fn lookup_repr_hints(tcx: &ctxt, did: DefId) -> Vec<attr::ReprAttr> {
|
||||
let mut acc = Vec::new();
|
||||
|
||||
ty::each_attr(tcx, did, |meta| {
|
||||
acc.extend(attr::find_repr_attrs(tcx.sess.diagnostic(), meta).move_iter());
|
||||
acc.extend(attr::find_repr_attrs(tcx.sess.diagnostic(), meta).into_iter());
|
||||
true
|
||||
});
|
||||
|
||||
|
@ -197,7 +197,7 @@ fn ast_path_substs<'tcx, AC: AstConv<'tcx>, RS: RegionScope>(
|
||||
}
|
||||
|
||||
match anon_regions {
|
||||
Ok(v) => v.move_iter().collect(),
|
||||
Ok(v) => v.into_iter().collect(),
|
||||
Err(()) => Vec::from_fn(expected_num_region_params,
|
||||
|_| ty::ReStatic) // hokey
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ fn ty_of_method_or_bare_fn<'tcx, AC: AstConv<'tcx>>(
|
||||
};
|
||||
let input_tys = input_tys.iter().map(|a| ty_of_arg(this, &rb, a, None));
|
||||
let self_and_input_tys: Vec<_> =
|
||||
self_ty.move_iter().chain(input_tys).collect();
|
||||
self_ty.into_iter().chain(input_tys).collect();
|
||||
|
||||
// Second, if there was exactly one lifetime (either a substitution or a
|
||||
// reference) in the arguments, then any anonymous regions in the output
|
||||
|
@ -179,7 +179,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,
|
||||
kind_name = "[error]";
|
||||
arg_types = subpats.clone()
|
||||
.unwrap_or_default()
|
||||
.move_iter()
|
||||
.into_iter()
|
||||
.map(|_| ty::mk_err())
|
||||
.collect();
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> {
|
||||
// find all the impls of that trait. Each of those are
|
||||
// candidates.
|
||||
let opt_applicable_traits = self.fcx.ccx.trait_map.find(&expr_id);
|
||||
for applicable_traits in opt_applicable_traits.move_iter() {
|
||||
for applicable_traits in opt_applicable_traits.into_iter() {
|
||||
for trait_did in applicable_traits.iter() {
|
||||
debug!("push_extension_candidates() found trait: {}",
|
||||
if trait_did.krate == ast::LOCAL_CRATE {
|
||||
@ -1322,7 +1322,7 @@ impl<'a, 'tcx> LookupContext<'a, 'tcx> {
|
||||
let args = fn_sig.inputs.slice_from(1).iter().map(|t| {
|
||||
t.subst(tcx, &all_substs)
|
||||
});
|
||||
Some(*fn_sig.inputs.get(0)).move_iter().chain(args).collect()
|
||||
Some(*fn_sig.inputs.get(0)).into_iter().chain(args).collect()
|
||||
}
|
||||
_ => fn_sig.inputs.subst(tcx, &all_substs)
|
||||
};
|
||||
|
@ -650,7 +650,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
|
||||
ast::ExprAssignOp(_, ref lhs, ref rhs) => {
|
||||
if has_method_map {
|
||||
constrain_call(rcx, expr, Some(&**lhs),
|
||||
Some(&**rhs).move_iter(), true);
|
||||
Some(&**rhs).into_iter(), true);
|
||||
}
|
||||
|
||||
adjust_borrow_kind_for_assignment_lhs(rcx, &**lhs);
|
||||
@ -665,7 +665,7 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
|
||||
// implicit "by ref" sort of passing style here. This
|
||||
// should be converted to an adjustment!
|
||||
constrain_call(rcx, expr, Some(&**lhs),
|
||||
Some(&**rhs).move_iter(), true);
|
||||
Some(&**rhs).into_iter(), true);
|
||||
|
||||
visit::walk_expr(rcx, expr);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ pub fn convert(ccx: &CrateCtxt, it: &ast::Item) {
|
||||
|
||||
convert_methods(ccx,
|
||||
ImplContainer(local_def(it.id)),
|
||||
methods.move_iter(),
|
||||
methods.into_iter(),
|
||||
selfty,
|
||||
&ty_generics,
|
||||
parent_visibility);
|
||||
@ -1273,10 +1273,10 @@ fn conv_param_bounds(ccx: &CrateCtxt,
|
||||
unboxed_fn_ty_bounds } =
|
||||
astconv::partition_bounds(ccx.tcx, span, all_bounds.as_slice());
|
||||
let unboxed_fn_ty_bounds =
|
||||
unboxed_fn_ty_bounds.move_iter()
|
||||
unboxed_fn_ty_bounds.into_iter()
|
||||
.map(|b| instantiate_unboxed_fn_ty(ccx, b, param_ty));
|
||||
let trait_bounds: Vec<Rc<ty::TraitRef>> =
|
||||
trait_bounds.move_iter()
|
||||
trait_bounds.into_iter()
|
||||
.map(|b| instantiate_trait_ref(ccx, b, param_ty.to_ty(ccx.tcx)))
|
||||
.chain(unboxed_fn_ty_bounds)
|
||||
.collect();
|
||||
|
@ -335,7 +335,7 @@ impl<'a, 'tcx> ErrorReporting for InferCtxt<'a, 'tcx> {
|
||||
same_frs: &FreeRegionsFromSameFn) {
|
||||
let scope_id = same_frs.scope_id;
|
||||
let (sub_fr, sup_fr) = (same_frs.sub_fr, same_frs.sup_fr);
|
||||
for sr in same_regions.mut_iter() {
|
||||
for sr in same_regions.iter_mut() {
|
||||
if sr.contains(&sup_fr.bound_region)
|
||||
&& scope_id == sr.scope_id {
|
||||
sr.push(sub_fr.bound_region);
|
||||
@ -1328,7 +1328,7 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
|
||||
ast::TyFixedLengthVec(build_to(ty, to), e)
|
||||
}
|
||||
ast::TyTup(tys) => {
|
||||
ast::TyTup(tys.move_iter().map(|ty| build_to(ty, to)).collect())
|
||||
ast::TyTup(tys.into_iter().map(|ty| build_to(ty, to)).collect())
|
||||
}
|
||||
ast::TyParen(typ) => ast::TyParen(build_to(typ, to)),
|
||||
other => other
|
||||
|
@ -84,6 +84,6 @@ impl Registry {
|
||||
|
||||
/// Register a lint group.
|
||||
pub fn register_lint_group(&mut self, name: &'static str, to: Vec<&'static Lint>) {
|
||||
self.lint_groups.insert(name, to.move_iter().map(|x| LintId::of(x)).collect());
|
||||
self.lint_groups.insert(name, to.into_iter().map(|x| LintId::of(x)).collect());
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ pub fn get_rpath_flags(config: RPathConfig) -> Vec<String> {
|
||||
debug!("preparing the RPATH!");
|
||||
|
||||
let libs = config.used_crates.clone();
|
||||
let libs = libs.move_iter().filter_map(|(_, l)| {
|
||||
let libs = libs.into_iter().filter_map(|(_, l)| {
|
||||
l.map(|p| p.clone())
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
|
@ -136,14 +136,14 @@ impl FixedBuffer for FixedBuffer64 {
|
||||
let buffer_remaining = size - self.buffer_idx;
|
||||
if input.len() >= buffer_remaining {
|
||||
copy_memory(
|
||||
self.buffer.mut_slice(self.buffer_idx, size),
|
||||
self.buffer.slice_mut(self.buffer_idx, size),
|
||||
input.slice_to(buffer_remaining));
|
||||
self.buffer_idx = 0;
|
||||
func(self.buffer);
|
||||
i += buffer_remaining;
|
||||
} else {
|
||||
copy_memory(
|
||||
self.buffer.mut_slice(self.buffer_idx, self.buffer_idx + input.len()),
|
||||
self.buffer.slice_mut(self.buffer_idx, self.buffer_idx + input.len()),
|
||||
input);
|
||||
self.buffer_idx += input.len();
|
||||
return;
|
||||
@ -162,7 +162,7 @@ impl FixedBuffer for FixedBuffer64 {
|
||||
// be empty.
|
||||
let input_remaining = input.len() - i;
|
||||
copy_memory(
|
||||
self.buffer.mut_slice(0, input_remaining),
|
||||
self.buffer.slice_mut(0, input_remaining),
|
||||
input.slice_from(i));
|
||||
self.buffer_idx += input_remaining;
|
||||
}
|
||||
@ -173,13 +173,13 @@ impl FixedBuffer for FixedBuffer64 {
|
||||
|
||||
fn zero_until(&mut self, idx: uint) {
|
||||
assert!(idx >= self.buffer_idx);
|
||||
self.buffer.mut_slice(self.buffer_idx, idx).set_memory(0);
|
||||
self.buffer.slice_mut(self.buffer_idx, idx).set_memory(0);
|
||||
self.buffer_idx = idx;
|
||||
}
|
||||
|
||||
fn next<'s>(&'s mut self, len: uint) -> &'s mut [u8] {
|
||||
self.buffer_idx += len;
|
||||
return self.buffer.mut_slice(self.buffer_idx - len, self.buffer_idx);
|
||||
return self.buffer.slice_mut(self.buffer_idx - len, self.buffer_idx);
|
||||
}
|
||||
|
||||
fn full_buffer<'s>(&'s mut self) -> &'s [u8] {
|
||||
@ -359,7 +359,7 @@ impl Engine256State {
|
||||
)
|
||||
)
|
||||
|
||||
read_u32v_be(w.mut_slice(0, 16), data);
|
||||
read_u32v_be(w.slice_mut(0, 16), data);
|
||||
|
||||
// Putting the message schedule inside the same loop as the round calculations allows for
|
||||
// the compiler to generate better code.
|
||||
@ -495,14 +495,14 @@ impl Digest for Sha256 {
|
||||
fn result(&mut self, out: &mut [u8]) {
|
||||
self.engine.finish();
|
||||
|
||||
write_u32_be(out.mut_slice(0, 4), self.engine.state.h0);
|
||||
write_u32_be(out.mut_slice(4, 8), self.engine.state.h1);
|
||||
write_u32_be(out.mut_slice(8, 12), self.engine.state.h2);
|
||||
write_u32_be(out.mut_slice(12, 16), self.engine.state.h3);
|
||||
write_u32_be(out.mut_slice(16, 20), self.engine.state.h4);
|
||||
write_u32_be(out.mut_slice(20, 24), self.engine.state.h5);
|
||||
write_u32_be(out.mut_slice(24, 28), self.engine.state.h6);
|
||||
write_u32_be(out.mut_slice(28, 32), self.engine.state.h7);
|
||||
write_u32_be(out.slice_mut(0, 4), self.engine.state.h0);
|
||||
write_u32_be(out.slice_mut(4, 8), self.engine.state.h1);
|
||||
write_u32_be(out.slice_mut(8, 12), self.engine.state.h2);
|
||||
write_u32_be(out.slice_mut(12, 16), self.engine.state.h3);
|
||||
write_u32_be(out.slice_mut(16, 20), self.engine.state.h4);
|
||||
write_u32_be(out.slice_mut(20, 24), self.engine.state.h5);
|
||||
write_u32_be(out.slice_mut(24, 28), self.engine.state.h6);
|
||||
write_u32_be(out.slice_mut(28, 32), self.engine.state.h7);
|
||||
}
|
||||
|
||||
fn reset(&mut self) {
|
||||
@ -631,7 +631,7 @@ mod tests {
|
||||
|
||||
let expected_vec: Vec<u8> = expected.from_hex()
|
||||
.unwrap()
|
||||
.move_iter()
|
||||
.into_iter()
|
||||
.collect();
|
||||
assert_eq!(expected_vec, result_bytes);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ pub fn try_inline(cx: &DocContext, id: ast::NodeId, into: Option<ast::Ident>)
|
||||
let did = def.def_id();
|
||||
if ast_util::is_local(did) { return None }
|
||||
try_inline_def(cx, tcx, def).map(|vec| {
|
||||
vec.move_iter().map(|mut item| {
|
||||
vec.into_iter().map(|mut item| {
|
||||
match into {
|
||||
Some(into) if item.name.is_some() => {
|
||||
item.name = Some(into.clean(cx));
|
||||
@ -84,12 +84,12 @@ fn try_inline_def(cx: &DocContext, tcx: &ty::ctxt,
|
||||
}
|
||||
def::DefStruct(did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeStruct);
|
||||
ret.extend(build_impls(cx, tcx, did).move_iter());
|
||||
ret.extend(build_impls(cx, tcx, did).into_iter());
|
||||
clean::StructItem(build_struct(cx, tcx, did))
|
||||
}
|
||||
def::DefTy(did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeEnum);
|
||||
ret.extend(build_impls(cx, tcx, did).move_iter());
|
||||
ret.extend(build_impls(cx, tcx, did).into_iter());
|
||||
build_type(cx, tcx, did)
|
||||
}
|
||||
// Assume that the enum type is reexported next to the variant, and
|
||||
@ -123,7 +123,7 @@ pub fn load_attrs(cx: &DocContext, tcx: &ty::ctxt,
|
||||
did: ast::DefId) -> Vec<clean::Attribute> {
|
||||
let mut attrs = Vec::new();
|
||||
csearch::get_item_attrs(&tcx.sess.cstore, did, |v| {
|
||||
attrs.extend(v.move_iter().map(|a| {
|
||||
attrs.extend(v.into_iter().map(|a| {
|
||||
a.clean(cx)
|
||||
}));
|
||||
});
|
||||
@ -138,7 +138,7 @@ pub fn record_extern_fqn(cx: &DocContext, did: ast::DefId, kind: clean::TypeKind
|
||||
match cx.tcx_opt() {
|
||||
Some(tcx) => {
|
||||
let fqn = csearch::get_item_path(tcx, did);
|
||||
let fqn = fqn.move_iter().map(|i| i.to_string()).collect();
|
||||
let fqn = fqn.into_iter().map(|i| i.to_string()).collect();
|
||||
cx.external_paths.borrow_mut().as_mut().unwrap().insert(did, (fqn, kind));
|
||||
}
|
||||
None => {}
|
||||
@ -150,7 +150,7 @@ pub fn build_external_trait(cx: &DocContext, tcx: &ty::ctxt,
|
||||
let def = ty::lookup_trait_def(tcx, did);
|
||||
let trait_items = ty::trait_items(tcx, did).clean(cx);
|
||||
let provided = ty::provided_trait_methods(tcx, did);
|
||||
let mut items = trait_items.move_iter().map(|trait_item| {
|
||||
let mut items = trait_items.into_iter().map(|trait_item| {
|
||||
if provided.iter().any(|a| a.def_id == trait_item.def_id) {
|
||||
clean::ProvidedMethod(trait_item)
|
||||
} else {
|
||||
@ -262,7 +262,7 @@ fn build_impls(cx: &DocContext, tcx: &ty::ctxt,
|
||||
}
|
||||
}
|
||||
|
||||
impls.move_iter().filter_map(|a| a).collect()
|
||||
impls.into_iter().filter_map(|a| a).collect()
|
||||
}
|
||||
|
||||
fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
|
||||
@ -369,7 +369,7 @@ fn build_module(cx: &DocContext, tcx: &ty::ctxt,
|
||||
}
|
||||
decoder::DlDef(def) if vis == ast::Public => {
|
||||
match try_inline_def(cx, tcx, def) {
|
||||
Some(i) => items.extend(i.move_iter()),
|
||||
Some(i) => items.extend(i.into_iter()),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let mut tmp = Vec::new();
|
||||
for child in m.items.mut_iter() {
|
||||
for child in m.items.iter_mut() {
|
||||
let inner = match child.inner {
|
||||
ModuleItem(ref mut m) => m,
|
||||
_ => continue,
|
||||
@ -171,7 +171,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
|
||||
inner.items.push(i);
|
||||
|
||||
}
|
||||
m.items.extend(tmp.move_iter());
|
||||
m.items.extend(tmp.into_iter());
|
||||
}
|
||||
|
||||
Crate {
|
||||
@ -333,8 +333,8 @@ impl Clean<Item> for doctree::Module {
|
||||
"".to_string()
|
||||
};
|
||||
let mut foreigns = Vec::new();
|
||||
for subforeigns in self.foreigns.clean(cx).move_iter() {
|
||||
for foreign in subforeigns.move_iter() {
|
||||
for subforeigns in self.foreigns.clean(cx).into_iter() {
|
||||
for foreign in subforeigns.into_iter() {
|
||||
foreigns.push(foreign)
|
||||
}
|
||||
}
|
||||
@ -348,8 +348,8 @@ impl Clean<Item> for doctree::Module {
|
||||
self.statics.clean(cx),
|
||||
self.traits.clean(cx),
|
||||
self.impls.clean(cx),
|
||||
self.view_items.clean(cx).move_iter()
|
||||
.flat_map(|s| s.move_iter()).collect(),
|
||||
self.view_items.clean(cx).into_iter()
|
||||
.flat_map(|s| s.into_iter()).collect(),
|
||||
self.macros.clean(cx),
|
||||
);
|
||||
|
||||
@ -538,7 +538,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
|
||||
external_path(cx, "Sync", &empty)),
|
||||
};
|
||||
let fqn = csearch::get_item_path(tcx, did);
|
||||
let fqn = fqn.move_iter().map(|i| i.to_string()).collect();
|
||||
let fqn = fqn.into_iter().map(|i| i.to_string()).collect();
|
||||
cx.external_paths.borrow_mut().as_mut().unwrap().insert(did,
|
||||
(fqn, TypeTrait));
|
||||
TraitBound(ResolvedPath {
|
||||
@ -556,7 +556,7 @@ impl Clean<TyParamBound> for ty::TraitRef {
|
||||
None => return RegionBound,
|
||||
};
|
||||
let fqn = csearch::get_item_path(tcx, self.def_id);
|
||||
let fqn = fqn.move_iter().map(|i| i.to_string())
|
||||
let fqn = fqn.into_iter().map(|i| i.to_string())
|
||||
.collect::<Vec<String>>();
|
||||
let path = external_path(cx, fqn.last().unwrap().as_slice(),
|
||||
&self.substs);
|
||||
@ -842,9 +842,9 @@ impl<'a> Clean<FnDecl> for (ast::DefId, &'a ty::FnSig) {
|
||||
fn clean(&self, cx: &DocContext) -> FnDecl {
|
||||
let (did, sig) = *self;
|
||||
let mut names = if did.node != 0 {
|
||||
csearch::get_method_arg_names(&cx.tcx().sess.cstore, did).move_iter()
|
||||
csearch::get_method_arg_names(&cx.tcx().sess.cstore, did).into_iter()
|
||||
} else {
|
||||
Vec::new().move_iter()
|
||||
Vec::new().into_iter()
|
||||
}.peekable();
|
||||
if names.peek().map(|s| s.as_slice()) == Some("self") {
|
||||
let _ = names.next();
|
||||
@ -1274,7 +1274,7 @@ impl Clean<Type> for ty::t {
|
||||
ty::ty_enum(did, ref substs) |
|
||||
ty::ty_trait(box ty::TyTrait { def_id: did, ref substs, .. }) => {
|
||||
let fqn = csearch::get_item_path(cx.tcx(), did);
|
||||
let fqn: Vec<String> = fqn.move_iter().map(|i| {
|
||||
let fqn: Vec<String> = fqn.into_iter().map(|i| {
|
||||
i.to_string()
|
||||
}).collect();
|
||||
let kind = match ty::get(*self).sty {
|
||||
@ -1739,7 +1739,7 @@ impl Clean<Item> for doctree::Impl {
|
||||
generics: self.generics.clean(cx),
|
||||
trait_: self.trait_.clean(cx),
|
||||
for_: self.for_.clean(cx),
|
||||
items: self.items.clean(cx).move_iter().map(|ti| {
|
||||
items: self.items.clean(cx).into_iter().map(|ti| {
|
||||
match ti {
|
||||
MethodImplItem(i) => i,
|
||||
}
|
||||
@ -1789,7 +1789,7 @@ impl Clean<Vec<Item>> for ast::ViewItem {
|
||||
let remaining = list.iter().filter(|path| {
|
||||
match inline::try_inline(cx, path.node.id(), None) {
|
||||
Some(items) => {
|
||||
ret.extend(items.move_iter()); false
|
||||
ret.extend(items.into_iter()); false
|
||||
}
|
||||
None => true,
|
||||
}
|
||||
@ -1804,7 +1804,7 @@ impl Clean<Vec<Item>> for ast::ViewItem {
|
||||
}
|
||||
ast::ViewPathSimple(ident, _, id) => {
|
||||
match inline::try_inline(cx, id, Some(ident)) {
|
||||
Some(items) => ret.extend(items.move_iter()),
|
||||
Some(items) => ret.extend(items.into_iter()),
|
||||
None => ret.push(convert(&self.node)),
|
||||
}
|
||||
}
|
||||
@ -2131,7 +2131,7 @@ fn lang_struct(cx: &DocContext, did: Option<ast::DefId>,
|
||||
None => return fallback(box t.clean(cx)),
|
||||
};
|
||||
let fqn = csearch::get_item_path(cx.tcx(), did);
|
||||
let fqn: Vec<String> = fqn.move_iter().map(|i| {
|
||||
let fqn: Vec<String> = fqn.into_iter().map(|i| {
|
||||
i.to_string()
|
||||
}).collect();
|
||||
cx.external_paths.borrow_mut().as_mut().unwrap().insert(did, (fqn, TypeStruct));
|
||||
|
@ -109,7 +109,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
|
||||
span_diagnostic_handler);
|
||||
|
||||
let mut cfg = config::build_configuration(&sess);
|
||||
for cfg_ in cfgs.move_iter() {
|
||||
for cfg_ in cfgs.into_iter() {
|
||||
let cfg_ = token::intern_and_get_ident(cfg_.as_slice());
|
||||
cfg.push(P(codemap::dummy_spanned(ast::MetaWord(cfg_))));
|
||||
}
|
||||
|
@ -192,10 +192,10 @@ mod imp {
|
||||
libc::FILE_SHARE_READ |
|
||||
libc::FILE_SHARE_DELETE |
|
||||
libc::FILE_SHARE_WRITE,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
libc::CREATE_ALWAYS,
|
||||
libc::FILE_ATTRIBUTE_NORMAL,
|
||||
ptr::mut_null())
|
||||
ptr::null_mut())
|
||||
};
|
||||
if handle == libc::INVALID_HANDLE_VALUE {
|
||||
fail!("create file error: {}", os::last_os_error());
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user