fix fallout

This commit is contained in:
Jorge Aparicio 2015-01-10 21:50:07 -05:00
parent 9fdc0effd2
commit f9865eac18
31 changed files with 118 additions and 43 deletions

View File

@ -576,6 +576,10 @@ extern fn panic_fmt(args: &core::fmt::Arguments,
#[lang = "eh_personality"] extern fn eh_personality() {} #[lang = "eh_personality"] extern fn eh_personality() {}
# #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 } # #[start] fn start(argc: isize, argv: *const *const u8) -> isize { 0 }
# fn main() {} # fn main() {}
# mod std { // for-loops
# pub use core::iter;
# pub use core::option;
# }
``` ```
Note that there is one extra lang item here which differs from the examples Note that there is one extra lang item here which differs from the examples

View File

@ -104,7 +104,9 @@ type MatchWords<'a> = Chain<Enumerate<Blocks<'a>>, Skip<Take<Enumerate<Repeat<u3
fn reverse_bits(byte: u8) -> u8 { fn reverse_bits(byte: u8) -> u8 {
let mut result = 0; let mut result = 0;
for i in 0..u8::BITS { // FIXME(#21245) use a for loop
let mut iter = 0..u8::BITS;
while let Some(i) = iter.next() {
result |= ((byte >> i) & 1) << (u8::BITS - 1 - i); result |= ((byte >> i) & 1) << (u8::BITS - 1 - i);
} }
result result

View File

@ -271,7 +271,7 @@ impl<T> DoubleEndedIterator for RawItems<T> {
#[unsafe_destructor] #[unsafe_destructor]
impl<T> Drop for RawItems<T> { impl<T> Drop for RawItems<T> {
fn drop(&mut self) { fn drop(&mut self) {
for _ in *self {} for _ in self.by_ref() {}
} }
} }
@ -1374,9 +1374,9 @@ impl<K, V> Drop for MoveTraversalImpl<K, V> {
fn drop(&mut self) { fn drop(&mut self) {
// We need to cleanup the stored values manually, as the RawItems destructor would run // We need to cleanup the stored values manually, as the RawItems destructor would run
// after our deallocation. // after our deallocation.
for _ in self.keys {} for _ in self.keys.by_ref() {}
for _ in self.vals {} for _ in self.vals.by_ref() {}
for _ in self.edges {} for _ in self.edges.by_ref() {}
let (alignment, size) = let (alignment, size) =
calculate_allocation_generic::<K, V>(self.capacity, self.is_leaf); calculate_allocation_generic::<K, V>(self.capacity, self.is_leaf);

View File

@ -34,6 +34,8 @@
#![feature(unicode)] #![feature(unicode)]
#![feature(hash)] #![feature(hash)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
// NOTE(stage0): remove after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
#[macro_use] #[macro_use]
extern crate core; extern crate core;
@ -114,6 +116,8 @@ mod std {
pub use core::marker; // derive(Copy) pub use core::marker; // derive(Copy)
pub use core::hash; // derive(Hash) pub use core::hash; // derive(Hash)
pub use core::ops; // RangeFull pub use core::ops; // RangeFull
// for-loops
pub use core::iter;
} }
#[cfg(test)] #[cfg(test)]

View File

@ -1510,7 +1510,7 @@ pub struct Drain<'a, T: 'a> {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> Drop for Drain<'a, T> { impl<'a, T: 'a> Drop for Drain<'a, T> {
fn drop(&mut self) { fn drop(&mut self) {
for _ in *self {} for _ in self.by_ref() {}
self.inner.head = 0; self.inner.head = 0;
self.inner.tail = 0; self.inner.tail = 0;
} }
@ -1793,7 +1793,9 @@ mod tests {
fn bench_push_back_100(b: &mut test::Bencher) { fn bench_push_back_100(b: &mut test::Bencher) {
let mut deq = RingBuf::with_capacity(101); let mut deq = RingBuf::with_capacity(101);
b.iter(|| { b.iter(|| {
for i in 0i..100 { // FIXME(#21245) use a for loop
let mut iter = 0i..100;
while let Some(i) = iter.next() {
deq.push_back(i); deq.push_back(i);
} }
deq.head = 0; deq.head = 0;
@ -1805,7 +1807,9 @@ mod tests {
fn bench_push_front_100(b: &mut test::Bencher) { fn bench_push_front_100(b: &mut test::Bencher) {
let mut deq = RingBuf::with_capacity(101); let mut deq = RingBuf::with_capacity(101);
b.iter(|| { b.iter(|| {
for i in 0i..100 { // FIXME(#21245) use a for loop
let mut iter = 0i..100;
while let Some(i) = iter.next() {
deq.push_front(i); deq.push_front(i);
} }
deq.head = 0; deq.head = 0;

View File

@ -1958,7 +1958,7 @@ mod tests {
let mut amt = 0; let mut amt = 0;
let mut it = v.permutations(); let mut it = v.permutations();
let (min_size, max_opt) = it.size_hint(); let (min_size, max_opt) = it.size_hint();
for _perm in it { for _perm in it.by_ref() {
amt += 1; amt += 1;
} }
assert_eq!(amt, it.swaps.swaps_made); assert_eq!(amt, it.swaps.swaps_made);

View File

@ -279,7 +279,7 @@ impl<'a> Iterator for Recompositions<'a> {
loop { loop {
match self.state { match self.state {
Composing => { Composing => {
for ch in self.iter { for ch in self.iter.by_ref() {
let ch_class = unicode::char::canonical_combining_class(ch); let ch_class = unicode::char::canonical_combining_class(ch);
if self.composee.is_none() { if self.composee.is_none() {
if ch_class != 0 { if ch_class != 0 {

View File

@ -1567,7 +1567,9 @@ impl<T> Drop for Vec<T> {
// zeroed (when moving out, because of #[unsafe_no_drop_flag]). // zeroed (when moving out, because of #[unsafe_no_drop_flag]).
if self.cap != 0 { if self.cap != 0 {
unsafe { unsafe {
for x in self.iter() { // FIXME(#21245) use a for loop
let mut iter = self.iter();
while let Some(x) = iter.next() {
ptr::read(x); ptr::read(x);
} }
dealloc(*self.ptr, self.cap) dealloc(*self.ptr, self.cap)
@ -1648,7 +1650,7 @@ impl<T> IntoIter<T> {
#[unstable(feature = "collections")] #[unstable(feature = "collections")]
pub fn into_inner(mut self) -> Vec<T> { pub fn into_inner(mut self) -> Vec<T> {
unsafe { unsafe {
for _x in self { } for _x in self.by_ref() { }
let IntoIter { allocation, cap, ptr: _ptr, end: _end } = self; let IntoIter { allocation, cap, ptr: _ptr, end: _end } = self;
mem::forget(self); mem::forget(self);
Vec { ptr: NonZero::new(allocation), cap: cap, len: 0 } Vec { ptr: NonZero::new(allocation), cap: cap, len: 0 }
@ -1726,7 +1728,7 @@ impl<T> Drop for IntoIter<T> {
fn drop(&mut self) { fn drop(&mut self) {
// destroy the remaining elements // destroy the remaining elements
if self.cap != 0 { if self.cap != 0 {
for _x in *self {} for _x in self.by_ref() {}
unsafe { unsafe {
dealloc(self.allocation, self.cap); dealloc(self.allocation, self.cap);
} }
@ -1816,7 +1818,7 @@ impl<'a, T> Drop for Drain<'a, T> {
// so we can use #[unsafe_no_drop_flag]. // so we can use #[unsafe_no_drop_flag].
// destroy the remaining elements // destroy the remaining elements
for _x in *self {} for _x in self.by_ref() {}
} }
} }

View File

@ -195,7 +195,7 @@ pub trait IteratorExt: Iterator + Sized {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn nth(&mut self, mut n: usize) -> Option<Self::Item> { fn nth(&mut self, mut n: usize) -> Option<Self::Item> {
for x in *self { for x in self.by_ref() {
if n == 0 { return Some(x) } if n == 0 { return Some(x) }
n -= 1; n -= 1;
} }
@ -492,7 +492,7 @@ pub trait IteratorExt: Iterator + Sized {
/// fn process<U: Iterator<Item=isize>>(it: U) -> isize { /// fn process<U: Iterator<Item=isize>>(it: U) -> isize {
/// let mut it = it.fuse(); /// let mut it = it.fuse();
/// let mut sum = 0; /// let mut sum = 0;
/// for x in it { /// for x in it.by_ref() {
/// if x > 5 { /// if x > 5 {
/// break; /// break;
/// } /// }
@ -660,7 +660,7 @@ pub trait IteratorExt: Iterator + Sized {
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool { fn any<F>(&mut self, mut f: F) -> bool where F: FnMut(Self::Item) -> bool {
for x in *self { if f(x) { return true; } } for x in self.by_ref() { if f(x) { return true; } }
false false
} }
@ -680,7 +680,7 @@ pub trait IteratorExt: Iterator + Sized {
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where
P: FnMut(&Self::Item) -> bool, P: FnMut(&Self::Item) -> bool,
{ {
for x in *self { for x in self.by_ref() {
if predicate(&x) { return Some(x) } if predicate(&x) { return Some(x) }
} }
None None
@ -703,7 +703,7 @@ pub trait IteratorExt: Iterator + Sized {
P: FnMut(Self::Item) -> bool, P: FnMut(Self::Item) -> bool,
{ {
let mut i = 0; let mut i = 0;
for x in *self { for x in self.by_ref() {
if predicate(x) { if predicate(x) {
return Some(i); return Some(i);
} }
@ -1664,7 +1664,7 @@ impl<A, I, P> Iterator for Filter<A, I, P> where I: Iterator<Item=A>, P: FnMut(&
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
for x in self.iter { for x in self.iter.by_ref() {
if (self.predicate)(&x) { if (self.predicate)(&x) {
return Some(x); return Some(x);
} else { } else {
@ -1728,7 +1728,7 @@ impl<A, B, I, F> Iterator for FilterMap<A, B, I, F> where
#[inline] #[inline]
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
for x in self.iter { for x in self.iter.by_ref() {
match (self.f)(x) { match (self.f)(x) {
Some(y) => return Some(y), Some(y) => return Some(y),
None => () None => ()
@ -1914,7 +1914,7 @@ impl<A, I, P> Iterator for SkipWhile<A, I, P> where I: Iterator<Item=A>, P: FnMu
#[inline] #[inline]
fn next(&mut self) -> Option<A> { fn next(&mut self) -> Option<A> {
for x in self.iter { for x in self.iter.by_ref() {
if self.flag || !(self.predicate)(&x) { if self.flag || !(self.predicate)(&x) {
self.flag = true; self.flag = true;
return Some(x); return Some(x);
@ -2207,7 +2207,7 @@ impl<A, B, I, U, F> Iterator for FlatMap<A, B, I, U, F> where
fn next(&mut self) -> Option<B> { fn next(&mut self) -> Option<B> {
loop { loop {
for inner in self.frontiter.iter_mut() { for inner in self.frontiter.iter_mut() {
for x in *inner { for x in inner.by_ref() {
return Some(x) return Some(x)
} }
} }

View File

@ -65,6 +65,8 @@
#![allow(unknown_features)] #![feature(int_uint)] #![allow(unknown_features)] #![feature(int_uint)]
#![feature(on_unimplemented)] #![feature(on_unimplemented)]
#![deny(missing_docs)] #![deny(missing_docs)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
#[macro_use] #[macro_use]
mod macros; mod macros;
@ -158,4 +160,6 @@ mod std {
pub use marker; pub use marker;
pub use ops; pub use ops;
pub use option; pub use option;
// for-loops
pub use iter;
} }

View File

@ -1524,7 +1524,7 @@ macro_rules! from_str_radix_float_impl {
let mut exp_info = None::<(char, uint)>; let mut exp_info = None::<(char, uint)>;
// Parse the integer part of the significand // Parse the integer part of the significand
for (i, c) in cs { for (i, c) in cs.by_ref() {
match c.to_digit(radix) { match c.to_digit(radix) {
Some(digit) => { Some(digit) => {
// shift significand one digit left // shift significand one digit left
@ -1572,7 +1572,7 @@ macro_rules! from_str_radix_float_impl {
// part of the significand // part of the significand
if exp_info.is_none() { if exp_info.is_none() {
let mut power = 1.0; let mut power = 1.0;
for (i, c) in cs { for (i, c) in cs.by_ref() {
match c.to_digit(radix) { match c.to_digit(radix) {
Some(digit) => { Some(digit) => {
// Decrease power one order of magnitude // Decrease power one order of magnitude

View File

@ -498,6 +498,8 @@ mod std {
pub use core::{option, fmt}; // panic!() pub use core::{option, fmt}; // panic!()
pub use core::clone; // derive Clone pub use core::clone; // derive Clone
pub use core::marker; pub use core::marker;
// for-loops
pub use core::iter;
} }
#[cfg(test)] #[cfg(test)]

View File

@ -41,6 +41,9 @@
#![feature(unicode)] #![feature(unicode)]
#![feature(hash)] #![feature(hash)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
extern crate arena; extern crate arena;
extern crate flate; extern crate flate;

View File

@ -352,7 +352,9 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
for (word_index, &word) in words.iter().enumerate() { for (word_index, &word) in words.iter().enumerate() {
if word != 0 { if word != 0 {
let base_index = word_index * uint::BITS; let base_index = word_index * uint::BITS;
for offset in 0u..uint::BITS { // FIXME(#21245) use a for loop
let mut iter = 0u..uint::BITS;
while let Some(offset) = iter.next() {
let bit = 1 << offset; let bit = 1 << offset;
if (word & bit) != 0 { if (word & bit) != 0 {
// NB: we round up the total number of bits // NB: we round up the total number of bits

View File

@ -41,6 +41,9 @@
#![feature(std_misc)] #![feature(std_misc)]
#![feature(unicode)] #![feature(unicode)]
#![feature(hash)] #![feature(hash)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
extern crate arena; extern crate arena;
extern crate flate; extern crate flate;

View File

@ -84,6 +84,9 @@ This API is completely unstable and subject to change.
#![feature(core)] #![feature(core)]
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(std_misc)] #![feature(std_misc)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] extern crate syntax; #[macro_use] extern crate syntax;

View File

@ -32,6 +32,9 @@
#![feature(test)] #![feature(test)]
#![feature(unicode)] #![feature(unicode)]
#![feature(hash)] #![feature(hash)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
extern crate arena; extern crate arena;
extern crate getopts; extern crate getopts;

View File

@ -148,7 +148,9 @@ impl<
fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> { fn decode<D: Decoder>(d: &mut D) -> Result<EnumSet<T>, D::Error> {
let bits = try!(d.read_uint()); let bits = try!(d.read_uint());
let mut set = EnumSet::new(); let mut set = EnumSet::new();
for bit in 0..uint::BITS { // FIXME(#21245) use a for loop
let mut iter = 0..uint::BITS;
while let Some(bit) = iter.next() {
if bits & (1 << bit) != 0 { if bits & (1 << bit) != 0 {
set.insert(CLike::from_uint(1 << bit)); set.insert(CLike::from_uint(1 << bit));
} }

View File

@ -232,7 +232,10 @@ pub fn escape_default<F>(c: u8, mut f: F) where
_ => { _ => {
f(b'\\'); f(b'\\');
f(b'x'); f(b'x');
for &offset in [4u, 0u].iter() { // FIXME(#21245) use a for loop
let arr = [4u, 0u];
let mut iter = arr.iter();
while let ::option::Option::Some(&offset) = ::iter::Iterator::next(&mut iter) {
match ((c as i32) >> offset) & 0xf { match ((c as i32) >> offset) & 0xf {
i @ 0 ... 9 => f(b'0' + (i as u8)), i @ 0 ... 9 => f(b'0' + (i as u8)),
i => f(b'a' + (i as u8 - 10)), i => f(b'a' + (i as u8 - 10)),

View File

@ -15,7 +15,7 @@ use self::BucketState::*;
use clone::Clone; use clone::Clone;
use cmp; use cmp;
use hash::{Hash, Hasher}; use hash::{Hash, Hasher};
use iter::{Iterator, ExactSizeIterator, count}; use iter::{Iterator, IteratorExt, ExactSizeIterator, count};
use marker::{Copy, Sized, self}; use marker::{Copy, Sized, self};
use mem::{min_align_of, size_of}; use mem::{min_align_of, size_of};
use mem; use mem;
@ -921,7 +921,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
#[unsafe_destructor] #[unsafe_destructor]
impl<'a, K: 'a, V: 'a> Drop for Drain<'a, K, V> { impl<'a, K: 'a, V: 'a> Drop for Drain<'a, K, V> {
fn drop(&mut self) { fn drop(&mut self) {
for _ in *self {} for _ in self.by_ref() {}
} }
} }

View File

@ -123,6 +123,9 @@
#![feature(rand)] #![feature(rand)]
#![feature(hash)] #![feature(hash)]
#![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(test))]
#![allow(unstable)]
// NOTE(stage0): remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
// Don't link to std. We are std. // Don't link to std. We are std.
#![no_std] #![no_std]
@ -310,4 +313,6 @@ mod std {
pub use slice; pub use slice;
pub use boxed; // used for vec![] pub use boxed; // used for vec![]
// for-loops
pub use iter;
} }

View File

@ -557,7 +557,7 @@ impl GenericPath for Path {
} }
(Some(a), Some(_)) => { (Some(a), Some(_)) => {
comps.push(".."); comps.push("..");
for _ in itb { for _ in itb.by_ref() {
comps.push(".."); comps.push("..");
} }
comps.push(a); comps.push(a);

View File

@ -404,7 +404,9 @@ mod test {
} }
// start all the tasks // start all the tasks
for tx in txs.iter() { // FIXME(#21245) use a for loop
let mut iter = txs.iter();
while let Some(tx) = iter.next() {
tx.send(()).unwrap(); tx.send(()).unwrap();
} }
} }

View File

@ -1476,7 +1476,9 @@ mod test {
let _t = Thread::spawn(move|| { let _t = Thread::spawn(move|| {
let mut count = 0; let mut count = 0;
for x in rx.iter() { // FIXME(#21245) use a for loop
let mut iter = rx.iter();
while let Some(x) = iter.next() {
if count >= 3 { if count >= 3 {
break; break;
} else { } else {
@ -1940,7 +1942,9 @@ mod sync_tests {
let _t = Thread::spawn(move|| { let _t = Thread::spawn(move|| {
let mut count = 0; let mut count = 0;
for x in rx.iter() { // FIXME(#21245) use a for loop
let mut iter = rx.iter();
while let Some(x) = iter.next() {
if count >= 3 { if count >= 3 {
break; break;
} else { } else {

View File

@ -185,7 +185,9 @@ mod tests {
let tx = tx.clone(); let tx = tx.clone();
let q = q.clone(); let q = q.clone();
Thread::spawn(move|| { Thread::spawn(move|| {
for i in 0..nmsgs { // FIXME(#21245) use a for loop
let mut iter = 0..nmsgs;
while let Some(i) = iter.next() {
q.push(i); q.push(i);
} }
tx.send(()).unwrap(); tx.send(()).unwrap();

View File

@ -37,10 +37,14 @@ pub trait MoveMap<T> {
impl<T> MoveMap<T> for Vec<T> { impl<T> MoveMap<T> for Vec<T> {
fn move_map<F>(mut self, mut f: F) -> Vec<T> where F: FnMut(T) -> T { fn move_map<F>(mut self, mut f: F) -> Vec<T> where F: FnMut(T) -> T {
for p in self.iter_mut() { // FIXME(#21245) use a for loop
unsafe { {
// FIXME(#5016) this shouldn't need to zero to be safe. let mut iter = self.iter_mut();
ptr::write(p, f(ptr::read_and_zero(p))); while let Some(p) = iter.next() {
unsafe {
// FIXME(#5016) this shouldn't need to zero to be safe.
ptr::write(p, f(ptr::read_and_zero(p)));
}
} }
} }
self self

View File

@ -39,6 +39,9 @@
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(std_misc)] #![feature(std_misc)]
#![feature(unicode)] #![feature(unicode)]
#![allow(unstable)]
// NOTE(stage0) remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
extern crate arena; extern crate arena;
extern crate fmt_macros; extern crate fmt_macros;

View File

@ -44,6 +44,9 @@
#![feature(rustc_private)] #![feature(rustc_private)]
#![feature(std_misc)] #![feature(std_misc)]
#![feature(hash)] #![feature(hash)]
#![allow(unstable)]
// NOTE(stage0): remove cfg_attr after a snapshot
#![cfg_attr(not(stage0), allow(unused_mut))]
extern crate getopts; extern crate getopts;
extern crate serialize; extern crate serialize;

View File

@ -84,4 +84,7 @@ mod std {
pub use core::cmp; pub use core::cmp;
pub use core::fmt; pub use core::fmt;
pub use core::marker; pub use core::marker;
// for-loops
pub use core::iter;
pub use core::option;
} }

View File

@ -133,7 +133,9 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
(i + 1) * chunk_size (i + 1) * chunk_size
}; };
for &init_i in vec_init_i[start..end].iter() { // FIXME(#21245) use a for loop
let mut iter = vec_init_i[start..end].iter();
while let Some(&init_i) = iter.next() {
write_line(init_i, init_r_slice, &mut res); write_line(init_i, init_r_slice, &mut res);
} }
@ -142,7 +144,9 @@ fn mandelbrot<W: old_io::Writer>(w: uint, mut out: W) -> old_io::IoResult<()> {
}).collect::<Vec<_>>(); }).collect::<Vec<_>>();
try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h)); try!(writeln!(&mut out as &mut Writer, "P4\n{} {}", w, h));
for res in data.into_iter() { // FIXME(#21245) use a for loop
let mut iter = data.into_iter();
while let Some(res) = iter.next() {
try!(out.write(res.join().ok().unwrap().as_slice())); try!(out.write(res.join().ok().unwrap().as_slice()));
} }
out.flush() out.flush()

View File

@ -180,7 +180,9 @@ fn make_masks() -> Vec<Vec<Vec<u64> > > {
// all unused piece can be placed on the board. // all unused piece can be placed on the board.
fn is_board_unfeasible(board: u64, masks: &Vec<Vec<Vec<u64>>>) -> bool { fn is_board_unfeasible(board: u64, masks: &Vec<Vec<Vec<u64>>>) -> bool {
let mut coverable = board; let mut coverable = board;
for (i, masks_at) in masks.iter().enumerate() { // FIXME(#21245) use a for loop
let mut iter = masks.iter().enumerate();
while let Some((i, masks_at)) = iter.next() {
if board & 1 << i != 0 { continue; } if board & 1 << i != 0 { continue; }
for (cur_id, pos_masks) in masks_at.iter().enumerate() { for (cur_id, pos_masks) in masks_at.iter().enumerate() {
if board & 1 << (50 + cur_id) != 0 { continue; } if board & 1 << (50 + cur_id) != 0 { continue; }
@ -222,7 +224,9 @@ fn to_vec(raw_sol: &List<u64>) -> Vec<u8> {
let mut sol = repeat('.' as u8).take(50).collect::<Vec<_>>(); let mut sol = repeat('.' as u8).take(50).collect::<Vec<_>>();
for &m in raw_sol.iter() { for &m in raw_sol.iter() {
let id = '0' as u8 + get_id(m); let id = '0' as u8 + get_id(m);
for i in 0u..50 { // FIXME(#21245) use a for loop
let mut iter = 0u..50;
while let Some(i) = iter.next() {
if m & 1 << i != 0 { if m & 1 << i != 0 {
sol[i] = id; sol[i] = id;
} }