Migrate users of 'loop' to 'continue'

Closes #9467
This commit is contained in:
Alex Crichton 2013-10-01 14:31:03 -07:00
parent 4af849bc12
commit 4f67dcb24a
49 changed files with 78 additions and 78 deletions

View File

@ -200,7 +200,7 @@ impl<'self> FromBase64 for &'self str {
'0'..'9' => buf |= val + 0x04,
'+'|'-' => buf |= 0x3E,
'/'|'_' => buf |= 0x3F,
'\r'|'\n' => loop,
'\r'|'\n' => continue,
'=' => break,
_ => return Err(format!("Invalid character '{}' at position {}",
self.char_at(idx), idx))

View File

@ -303,7 +303,7 @@ impl io::Reader for FileInput {
let b = r.read_byte();
if b < 0 {
loop;
continue;
}
if b == '\n' as int {

View File

@ -211,7 +211,7 @@ impl Pattern {
let cs = parse_char_specifiers(chars.slice(i + 2, i + 3 + j));
tokens.push(AnyExcept(cs));
i += j + 4;
loop;
continue;
}
}
}
@ -222,7 +222,7 @@ impl Pattern {
let cs = parse_char_specifiers(chars.slice(i + 1, i + 2 + j));
tokens.push(AnyWithin(cs));
i += j + 3;
loop;
continue;
}
}
}

View File

@ -100,7 +100,7 @@ impl<'self> FromHex for &'self str {
'0'..'9' => buf |= byte - ('0' as u8),
' '|'\r'|'\n'|'\t' => {
buf >>= 4;
loop
continue
}
_ => return Err(format!("Invalid character '{}' at position {}",
self.char_at(idx), idx))

View File

@ -413,7 +413,7 @@ impl Integer for BigUint {
}
if d0.is_zero() {
n = 2;
loop;
continue;
}
n = 1;
// FIXME(#6102): Assignment operator for BigInt causes ICE

View File

@ -140,7 +140,7 @@ impl<T:Ord> PriorityQueue<T> {
let x = replace(&mut self.data[parent], init());
move_val_init(&mut self.data[pos], x);
pos = parent;
loop
continue
}
break
}

View File

@ -276,7 +276,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
for (i, v) in string_offsets.iter().enumerate() {
let offset = *v;
if offset == 0xFFFF { // non-entry
loop;
continue;
}
let name = if snames[i] == "_" {
@ -289,7 +289,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
// undocumented: FFFE indicates cap@, which means the capability is not present
// unsure if the handling for this is correct
string_map.insert(name.to_owned(), ~[]);
loop;
continue;
}

View File

@ -359,12 +359,12 @@ pub fn query_to_str(query: &Query) -> ~str {
pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> {
for (i,c) in rawurl.iter().enumerate() {
match c {
'A' .. 'Z' | 'a' .. 'z' => loop,
'A' .. 'Z' | 'a' .. 'z' => continue,
'0' .. '9' | '+' | '-' | '.' => {
if i == 0 {
return Err(~"url: Scheme must begin with a letter.");
}
loop;
continue;
}
':' => {
if i == 0 {
@ -420,7 +420,7 @@ fn get_authority(rawurl: &str) ->
let mut end = len;
for (i,c) in rawurl.iter().enumerate() {
if i < 2 { loop; } // ignore the leading //
if i < 2 { continue; } // ignore the leading //
// deal with input class first
match c {
@ -558,7 +558,7 @@ fn get_path(rawurl: &str, authority: bool) ->
'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.'
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
| '_' | '-' => {
loop;
continue;
}
'?' | '#' => {
end = i;

View File

@ -247,7 +247,7 @@ pub fn main() {
os::set_exit_status(exit_code);
return;
}
_ => loop
_ => {}
}
}
}

View File

@ -1004,7 +1004,7 @@ pub fn link_args(sess: Session,
for cratepath in r.iter() {
if cratepath.filetype() == Some(".rlib") {
args.push(cratepath.to_str());
loop;
continue;
}
let dir = cratepath.dirname();
if dir != ~"" { args.push(~"-L" + dir); }

View File

@ -263,8 +263,8 @@ impl<'self> CheckLoanCtxt<'self> {
debug2!("illegal_if={:?}", illegal_if);
for restr in loan1.restrictions.iter() {
if !restr.set.intersects(illegal_if) { loop; }
if restr.loan_path != loan2.loan_path { loop; }
if !restr.set.intersects(illegal_if) { continue; }
if restr.loan_path != loan2.loan_path { continue; }
match (new_loan.mutbl, old_loan.mutbl) {
(MutableMutability, MutableMutability) => {

View File

@ -613,7 +613,7 @@ pub fn each_lint(sess: session::Session,
ast::MetaList(_, ref metas) => metas,
_ => {
sess.span_err(meta.span, "malformed lint attribute");
loop;
continue;
}
};
for meta in metas.iter() {

View File

@ -225,7 +225,7 @@ impl PrivacyVisitor {
fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident) {
let fields = ty::lookup_struct_fields(self.tcx, id);
for field in fields.iter() {
if field.name != ident.name { loop; }
if field.name != ident.name { continue; }
if field.vis == private {
self.tcx.sess.span_err(span, format!("field `{}` is private",
token::ident_to_str(&ident)));

View File

@ -359,7 +359,7 @@ impl ReachableContext {
while self.worklist.len() > 0 {
let search_item = self.worklist.pop();
if scanned.contains(&search_item) {
loop
continue
}
scanned.insert(search_item);
self.reachable_symbols.insert(search_item);

View File

@ -3334,7 +3334,7 @@ impl Resolver {
if importresolution.privacy != Public {
debug2!("(computing exports) not reexporting private `{}`",
interner_get(*name));
loop;
continue;
}
let xs = [TypeNS, ValueNS];
for ns in xs.iter() {

View File

@ -317,7 +317,7 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
let vec_ty = Type::vector(&Type::f32(), (vec_len * 2u) as u64);
tys.push(vec_ty);
i += vec_len;
loop;
continue;
}
SSEFs => {
tys.push(Type::f32());

View File

@ -799,7 +799,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, ast_bounds: &Option<OptVec<ast::TyParamBou
ast::DefTrait(trait_did) => {
if ty::try_add_builtin_trait(tcx, trait_did,
&mut builtin_bounds) {
loop; // success
continue; // success
}
}
_ => { }

View File

@ -330,7 +330,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
if !etc {
for (i, field) in class_fields.iter().enumerate() {
if found_fields.contains(&i) {
loop;
continue;
}
tcx.sess.span_err(span,
format!("pattern does not mention field `{}`",

View File

@ -922,7 +922,7 @@ impl<'self> LookupContext<'self> {
if skip {
// There are more than one of these and we need only one
loop;
continue;
} else {
merged.push(candidate_a.clone());
}

View File

@ -338,7 +338,7 @@ fn search_for_vtable(vcx: &VtableContext,
// First, ensure we haven't processed this impl yet.
if impls_seen.contains(&im.did) {
loop;
continue;
}
impls_seen.insert(im.did);
@ -349,7 +349,7 @@ fn search_for_vtable(vcx: &VtableContext,
// get all the ty vars sorted out.
let r = ty::impl_trait_ref(tcx, im.did);
let of_trait_ref = r.expect("trait_ref missing on trait impl");
if of_trait_ref.def_id != trait_ref.def_id { loop; }
if of_trait_ref.def_id != trait_ref.def_id { continue; }
// At this point, we know that of_trait_ref is the same trait
// as trait_ref, but possibly applied to different substs.
@ -377,7 +377,7 @@ fn search_for_vtable(vcx: &VtableContext,
location_info.span),
ty,
for_ty) {
result::Err(_) => loop,
result::Err(_) => continue,
result::Ok(()) => ()
}

View File

@ -558,7 +558,7 @@ impl CoherenceChecker {
let r = ty::trait_methods(tcx, trait_did);
for method in r.iter() {
debug2!("checking for {}", method.ident.repr(tcx));
if provided_names.contains(&method.ident.name) { loop; }
if provided_names.contains(&method.ident.name) { continue; }
tcx.sess.span_err(trait_ref_span,
format!("missing method `{}`",
@ -730,7 +730,7 @@ impl CoherenceChecker {
for impl_info in impls.iter() {
if impl_info.methods.len() < 1 {
// We'll error out later. For now, just don't ICE.
loop;
continue;
}
let method_def_id = impl_info.methods[0].def_id;

View File

@ -919,7 +919,7 @@ impl RegionVarBindings {
ConstrainVarSubVar(*) |
ConstrainRegSubVar(*) |
ConstrainVarSubReg(*) => {
loop;
continue;
}
ConstrainRegSubReg(sub, sup) => {
(sub, sup)
@ -927,7 +927,7 @@ impl RegionVarBindings {
};
if self.is_subregion_of(sub, sup) {
loop;
continue;
}
debug2!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}",

View File

@ -199,10 +199,10 @@ impl Combine for Sub {
// or new variables:
match *tainted_region {
ty::re_infer(ty::ReVar(ref vid)) => {
if new_vars.iter().any(|x| x == vid) { loop; }
if new_vars.iter().any(|x| x == vid) { continue; }
}
_ => {
if *tainted_region == skol { loop; }
if *tainted_region == skol { continue; }
}
};

View File

@ -225,7 +225,7 @@ fn clean_srcpath(src: &str, f: &fn(&str)) {
let p = Path(src);
for c in p.components.iter() {
if "." == *c {
loop
continue
}
if ".." == *c {
f("up");
@ -928,7 +928,7 @@ fn item_module(w: &mut io::Writer, cx: &Context,
}
_ => {
if myitem.name.is_none() { loop }
if myitem.name.is_none() { continue }
write!(w, "
<tr>
<td><a class='{class}' href='{href}'
@ -1276,15 +1276,15 @@ fn render_impl(w: &mut io::Writer, i: &clean::Impl, dox: &Option<~str>) {
match meth.doc_value() {
Some(s) => {
write!(w, "<div class='docblock'>{}</div>", Markdown(s));
loop
continue
}
None => {}
}
// No documentation? Attempt to slurp in the trait's documentation
let trait_id = match trait_id {
None => loop,
Some(id) if is_local(id) => loop,
None => continue,
Some(id) if is_local(id) => continue,
Some(id) => id.node,
};
do local_data::get(cache_key) |cache| {
@ -1369,7 +1369,7 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
for item in m.items.iter() {
let short = shortty(item);
let myname = match item.name {
None => loop,
None => continue,
Some(ref s) => s.to_owned(),
};
let v = map.find_or_insert_with(short.to_owned(), |_| ~[]);

View File

@ -234,7 +234,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
Some(i) => PASSES[i].n1(),
None => {
error2!("unknown pass {}, skipping", *pass);
loop
continue
},
};
pm.add_plugin(plugin);

View File

@ -569,7 +569,7 @@ pub fn main_args(args: &[~str]) -> int {
if istty {
println("()");
}
loop;
continue;
}
run_line(&mut repl, input, out, line, istty);
}

View File

@ -233,7 +233,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
// Find a filename that matches the pattern: (lib_prefix)-hash-(version)(lib_suffix)
// and remember what the hash was
let mut f_name = match p_path.filestem() {
Some(s) => s, None => loop
Some(s) => s, None => continue
};
// Already checked the filetype above

View File

@ -101,7 +101,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> {
let local_path = rp.push_rel(local_path);
let git_dir = local_path.push(".git");
if !os::path_is_dir(&git_dir) {
loop;
continue;
}
let outp = run::process_output("git",
[format!("--git-dir={}", git_dir.to_str()), ~"tag", ~"-l"]);
@ -109,7 +109,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> {
debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.to_str(), outp.status);
if outp.status != 0 {
loop;
continue;
}
let mut output = None;

View File

@ -665,7 +665,7 @@ impl<T:Reader> ReaderUtil for T {
unsafe {
chars.push(transmute(b0 as u32));
}
loop;
continue;
}
// can't satisfy this char with the existing data
if end > bytes_len {

View File

@ -1150,7 +1150,7 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for Filter<'self, A, T> {
if (self.predicate)(&x) {
return Some(x);
} else {
loop
continue
}
}
None
@ -1173,7 +1173,7 @@ impl<'self, A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Filter<'sel
if (self.predicate)(&x) {
return Some(x);
} else {
loop
continue
}
}
}
@ -1342,7 +1342,7 @@ impl<'self, A, T: Iterator<A>> Iterator<A> for SkipWhile<'self, A, T> {
Some(x) => {
if (self.predicate)(&x) {
next = self.iter.next();
loop
continue
} else {
self.flag = true;
return Some(x)
@ -1415,7 +1415,7 @@ impl<A, T: Iterator<A>> Iterator<A> for Skip<T> {
match next {
Some(_) => {
next = self.iter.next();
loop
continue
}
None => {
self.n = 0;

View File

@ -355,7 +355,7 @@ pub fn float_to_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Float+Round+
}
// Skip the '.'
if buf[i] == '.' as u8 { i -= 1; loop; }
if buf[i] == '.' as u8 { i -= 1; continue; }
// Either increment the digit,
// or set to 0 if max and carry the 1.

View File

@ -992,11 +992,11 @@ impl GenericPath for WindowsPath {
pub fn normalize(components: &[~str]) -> ~[~str] {
let mut cs = ~[];
for c in components.iter() {
if *c == ~"." && components.len() > 1 { loop; }
if *c == ~"" { loop; }
if *c == ~"." && components.len() > 1 { continue; }
if *c == ~"" { continue; }
if *c == ~".." && cs.len() != 0 {
cs.pop();
loop;
continue;
}
cs.push((*c).clone());
}

View File

@ -543,7 +543,7 @@ pub trait Rng {
for (i, elem) in iter.enumerate() {
if i < n {
reservoir.push(elem);
loop
continue
}
let k = self.gen_integer_range(0, i + 1);

View File

@ -92,14 +92,14 @@ fn parse_logging_spec(spec: ~str) -> ~[LogDirective]{
_ => {
dumb_println(format!("warning: invalid logging spec \
'{}', ignoring it", parts[1]));
loop;
continue;
}
}
},
_ => {
dumb_println(format!("warning: invalid logging spec '{}',\
ignoring it", s));
loop;
continue;
}
}
let dir = LogDirective {name: name, level: log_level};

View File

@ -1057,12 +1057,12 @@ mod test {
Mark(mrk,tail) => {
result.push(M(mrk));
sc = tail;
loop;
continue;
},
Rename(id,name,tail) => {
result.push(R(id,name));
sc = tail;
loop;
continue;
}
IllegalCtxt => fail2!("expected resolvable context, got IllegalCtxt")
}

View File

@ -340,7 +340,7 @@ pub fn find_stability<AM: AttrMetaMethods, It: Iterator<AM>>(mut metas: It) -> O
"stable" => Stable,
"frozen" => Frozen,
"locked" => Locked,
_ => loop // not a stability level
_ => continue // not a stability level
};
return Some(Stability {

View File

@ -108,7 +108,7 @@ impl Context {
named `{}`", name));
self.ecx.parse_sess.span_diagnostic.span_note(
prev.span, "previously here");
loop
continue
}
}
self.names.insert(name, e);
@ -592,7 +592,7 @@ impl Context {
// of each variable because we don't want to move out of the arguments
// passed to this function.
for (i, &e) in self.args.iter().enumerate() {
if self.arg_types[i].is_none() { loop } // error already generated
if self.arg_types[i].is_none() { continue } // error already generated
let name = self.ecx.ident_of(format!("__arg{}", i));
let e = self.ecx.expr_addr_of(e.span, e);
@ -601,7 +601,7 @@ impl Context {
self.ecx.expr_ident(e.span, name)));
}
for (&name, &e) in self.names.iter() {
if !self.name_types.contains_key(&name) { loop }
if !self.name_types.contains_key(&name) { continue }
let lname = self.ecx.ident_of(format!("__arg{}", name));
let e = self.ecx.expr_addr_of(e.span, e);

View File

@ -431,7 +431,7 @@ fn scan_digits(rdr: @mut StringReader, radix: uint) -> ~str {
let mut rslt = ~"";
loop {
let c = rdr.curr;
if c == '_' { bump(rdr); loop; }
if c == '_' { bump(rdr); continue; }
match char::to_digit(c, radix) {
Some(_) => {
rslt.push_char(c);

View File

@ -1987,7 +1987,7 @@ impl Parser {
}
_ => self.unexpected()
}
loop;
continue;
}
if self.expr_is_complete(e) { break; }
match *self.token {

View File

@ -1406,7 +1406,7 @@ pub fn print_expr(s: @ps, expr: &ast::Expr) {
}
}
ast::ExprAgain(opt_ident) => {
word(s.s, "loop");
word(s.s, "continue");
space(s.s);
for ident in opt_ident.iter() {
word(s.s, "'");

View File

@ -196,7 +196,7 @@ fn main() {
while !rdr.eof() {
let line: ~str = rdr.read_line();
if line.len() == 0u { loop; }
if line.len() == 0u { continue; }
match (line[0] as char, proc_mode) {

View File

@ -130,7 +130,7 @@ fn main() {
stdout);
pos = 0;
loop;
continue;
}
// Complement other lines.

View File

@ -135,7 +135,7 @@ fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) {
// this borrow is limited to the scope of `r`...
let r: &'r mut uint = produce();
if !f(&mut *r) {
loop; // ...so it is not live as exit (and re-enter) the `while` loop here
continue; // ...so it is not live as exit (and re-enter) the `while` loop here
}
}
}

View File

@ -19,15 +19,15 @@ pub fn main() {
if *x == 3 { break; } assert!((*x <= 3));
}
i = 0;
while i < 10 { i += 1; if i % 2 == 0 { loop; } assert!((i % 2 != 0)); }
while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); }
i = 0;
loop {
i += 1; if i % 2 == 0 { loop; } assert!((i % 2 != 0));
i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0));
if i >= 10 { break; }
}
let ys = ~[1, 2, 3, 4, 5, 6];
for x in ys.iter() {
if *x % 2 == 0 { loop; }
if *x % 2 == 0 { continue; }
assert!((*x % 2 != 0));
}
}

View File

@ -13,7 +13,7 @@ pub fn main() {
let mut y = 0;
for (n,i) in x.iter().enumerate() {
if n < 10 {
loop;
continue;
}
y += *i;
}

View File

@ -21,7 +21,7 @@ pub fn main() {
break 'bar;
}
}
loop 'foo;
continue 'foo;
}
x = 42;
break;

View File

@ -27,7 +27,7 @@ pub fn main() {
is_even = false;
i += 1u;
if i % 2u != 0u {
loop;
continue;
}
is_even = true;
}
@ -40,7 +40,7 @@ pub fn main() {
is_even = false;
i += 1u;
if i % 2u != 0u {
loop;
continue;
}
is_even = true;
}

View File

@ -17,7 +17,7 @@ use std::task;
fn test_break() { loop { let _x: @int = break; } }
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: @int = loop; } }
fn test_cont() { let mut i = 0; while i < 1 { i += 1; let _x: @int = continue; } }
fn test_ret() { let _x: @int = return; }

View File

@ -67,7 +67,7 @@ fn canttouchthis() -> uint {
fn angrydome() {
loop { if break { } }
let mut i = 0;
loop { i += 1; if i == 1 { match (loop) { 1 => { }, _ => fail2!("wat") } }
loop { i += 1; if i == 1 { match (continue) { 1 => { }, _ => fail2!("wat") } }
break; }
}