From 4f67dcb24adb1e23f04e624fcbaf2328b82491b6 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 1 Oct 2013 14:31:03 -0700 Subject: [PATCH] Migrate users of 'loop' to 'continue' Closes #9467 --- src/libextra/base64.rs | 2 +- src/libextra/fileinput.rs | 2 +- src/libextra/glob.rs | 4 ++-- src/libextra/hex.rs | 2 +- src/libextra/num/bigint.rs | 2 +- src/libextra/priority_queue.rs | 2 +- src/libextra/terminfo/parser/compiled.rs | 4 ++-- src/libextra/url.rs | 8 ++++---- src/librust/rust.rs | 2 +- src/librustc/back/link.rs | 2 +- src/librustc/middle/borrowck/check_loans.rs | 4 ++-- src/librustc/middle/lint.rs | 2 +- src/librustc/middle/privacy.rs | 2 +- src/librustc/middle/reachable.rs | 2 +- src/librustc/middle/resolve.rs | 2 +- src/librustc/middle/trans/cabi_x86_64.rs | 2 +- src/librustc/middle/typeck/astconv.rs | 2 +- src/librustc/middle/typeck/check/_match.rs | 2 +- src/librustc/middle/typeck/check/method.rs | 2 +- src/librustc/middle/typeck/check/vtable.rs | 6 +++--- src/librustc/middle/typeck/coherence.rs | 4 ++-- .../middle/typeck/infer/region_inference/mod.rs | 4 ++-- src/librustc/middle/typeck/infer/sub.rs | 4 ++-- src/librustdoc/html/render.rs | 12 ++++++------ src/librustdoc/rustdoc.rs | 2 +- src/librusti/rusti.rs | 2 +- src/librustpkg/path_util.rs | 2 +- src/librustpkg/version.rs | 4 ++-- src/libstd/io.rs | 2 +- src/libstd/iter.rs | 8 ++++---- src/libstd/num/strconv.rs | 2 +- src/libstd/path.rs | 6 +++--- src/libstd/rand/mod.rs | 2 +- src/libstd/rt/logging.rs | 4 ++-- src/libsyntax/ast_util.rs | 4 ++-- src/libsyntax/attr.rs | 2 +- src/libsyntax/ext/format.rs | 6 +++--- src/libsyntax/parse/lexer.rs | 2 +- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/print/pprust.rs | 2 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 2 +- src/test/bench/shootout-reverse-complement.rs | 2 +- src/test/compile-fail/borrowck-lend-flow-loop.rs | 2 +- src/test/run-pass/break.rs | 6 +++--- src/test/run-pass/foreach-external-iterators-loop.rs | 2 +- src/test/run-pass/issue-2216.rs | 2 +- src/test/run-pass/loop-break-cont.rs | 4 ++-- src/test/run-pass/terminate-in-initializer.rs | 2 +- src/test/run-pass/weird-exprs.rs | 2 +- 49 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/libextra/base64.rs b/src/libextra/base64.rs index ed366047c84..2b18c27f560 100644 --- a/src/libextra/base64.rs +++ b/src/libextra/base64.rs @@ -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)) diff --git a/src/libextra/fileinput.rs b/src/libextra/fileinput.rs index 37bcb447f08..e85b715b21a 100644 --- a/src/libextra/fileinput.rs +++ b/src/libextra/fileinput.rs @@ -303,7 +303,7 @@ impl io::Reader for FileInput { let b = r.read_byte(); if b < 0 { - loop; + continue; } if b == '\n' as int { diff --git a/src/libextra/glob.rs b/src/libextra/glob.rs index 9af2f1acc69..112ea142189 100644 --- a/src/libextra/glob.rs +++ b/src/libextra/glob.rs @@ -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; } } } diff --git a/src/libextra/hex.rs b/src/libextra/hex.rs index 709b4a95981..d6e0d8f99c2 100644 --- a/src/libextra/hex.rs +++ b/src/libextra/hex.rs @@ -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)) diff --git a/src/libextra/num/bigint.rs b/src/libextra/num/bigint.rs index 2ec9c747179..48fcd972c3c 100644 --- a/src/libextra/num/bigint.rs +++ b/src/libextra/num/bigint.rs @@ -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 diff --git a/src/libextra/priority_queue.rs b/src/libextra/priority_queue.rs index 6dd4759d927..587f8372087 100644 --- a/src/libextra/priority_queue.rs +++ b/src/libextra/priority_queue.rs @@ -140,7 +140,7 @@ impl PriorityQueue { let x = replace(&mut self.data[parent], init()); move_val_init(&mut self.data[pos], x); pos = parent; - loop + continue } break } diff --git a/src/libextra/terminfo/parser/compiled.rs b/src/libextra/terminfo/parser/compiled.rs index caef3e70ce8..0adf86ed931 100644 --- a/src/libextra/terminfo/parser/compiled.rs +++ b/src/libextra/terminfo/parser/compiled.rs @@ -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; } diff --git a/src/libextra/url.rs b/src/libextra/url.rs index 7a10c0439da..2afc49df43a 100644 --- a/src/libextra/url.rs +++ b/src/libextra/url.rs @@ -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; diff --git a/src/librust/rust.rs b/src/librust/rust.rs index 0b4d07a6ebf..cdd71fc3d09 100644 --- a/src/librust/rust.rs +++ b/src/librust/rust.rs @@ -247,7 +247,7 @@ pub fn main() { os::set_exit_status(exit_code); return; } - _ => loop + _ => {} } } } diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index ca2e1cbde7b..4106d2365b5 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -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); } diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 5334bf7cc1d..73c77cdddd9 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -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) => { diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 591ca2ada5a..4f099308218 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -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() { diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 8b2e581836b..7088091e192 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -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))); diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 6973b46c92c..79685543450 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -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); diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 4b5141f1630..4ad9371e2be 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -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() { diff --git a/src/librustc/middle/trans/cabi_x86_64.rs b/src/librustc/middle/trans/cabi_x86_64.rs index 9f098fe3cc1..40a09e3507c 100644 --- a/src/librustc/middle/trans/cabi_x86_64.rs +++ b/src/librustc/middle/trans/cabi_x86_64.rs @@ -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()); diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 91bb4df3017..7a88b93cd37 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -799,7 +799,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, ast_bounds: &Option { if ty::try_add_builtin_trait(tcx, trait_did, &mut builtin_bounds) { - loop; // success + continue; // success } } _ => { } diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index f022f2b3c4b..cd681a3dcf9 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -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 `{}`", diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index a4538c961fd..8bfef838c9c 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -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()); } diff --git a/src/librustc/middle/typeck/check/vtable.rs b/src/librustc/middle/typeck/check/vtable.rs index 146be8b85ad..074603fb7a0 100644 --- a/src/librustc/middle/typeck/check/vtable.rs +++ b/src/librustc/middle/typeck/check/vtable.rs @@ -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(()) => () } diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index f6c24e3cd23..9ad8377cdd1 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -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; diff --git a/src/librustc/middle/typeck/infer/region_inference/mod.rs b/src/librustc/middle/typeck/infer/region_inference/mod.rs index e5492453b98..3ab7ced3941 100644 --- a/src/librustc/middle/typeck/infer/region_inference/mod.rs +++ b/src/librustc/middle/typeck/infer/region_inference/mod.rs @@ -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={:?}", diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index ad251a5be9e..2a2d7fbcfc7 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -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; } } }; diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 1dde7bd80d4..b7ee60b9f54 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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, " ) { match meth.doc_value() { Some(s) => { write!(w, "
{}
", 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(), |_| ~[]); diff --git a/src/librustdoc/rustdoc.rs b/src/librustdoc/rustdoc.rs index a7eac9f268d..b953fe1ed5d 100644 --- a/src/librustdoc/rustdoc.rs +++ b/src/librustdoc/rustdoc.rs @@ -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); diff --git a/src/librusti/rusti.rs b/src/librusti/rusti.rs index a3185ee9438..9da8c58fd05 100644 --- a/src/librusti/rusti.rs +++ b/src/librusti/rusti.rs @@ -569,7 +569,7 @@ pub fn main_args(args: &[~str]) -> int { if istty { println("()"); } - loop; + continue; } run_line(&mut repl, input, out, line, istty); } diff --git a/src/librustpkg/path_util.rs b/src/librustpkg/path_util.rs index 9a440cb5f8f..5b701bcb660 100644 --- a/src/librustpkg/path_util.rs +++ b/src/librustpkg/path_util.rs @@ -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 diff --git a/src/librustpkg/version.rs b/src/librustpkg/version.rs index a59d2bb2887..12226b77eea 100644 --- a/src/librustpkg/version.rs +++ b/src/librustpkg/version.rs @@ -101,7 +101,7 @@ pub fn try_getting_local_version(local_path: &Path) -> Option { 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 { debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.to_str(), outp.status); if outp.status != 0 { - loop; + continue; } let mut output = None; diff --git a/src/libstd/io.rs b/src/libstd/io.rs index dfe517932fc..2dfd41a4435 100644 --- a/src/libstd/io.rs +++ b/src/libstd/io.rs @@ -665,7 +665,7 @@ impl 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 { diff --git a/src/libstd/iter.rs b/src/libstd/iter.rs index f1e0eff5616..215f11980a1 100644 --- a/src/libstd/iter.rs +++ b/src/libstd/iter.rs @@ -1150,7 +1150,7 @@ impl<'self, A, T: Iterator
> Iterator 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> DoubleEndedIterator for Filter<'sel if (self.predicate)(&x) { return Some(x); } else { - loop + continue } } } @@ -1342,7 +1342,7 @@ impl<'self, A, T: Iterator> Iterator 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> Iterator for Skip { match next { Some(_) => { next = self.iter.next(); - loop + continue } None => { self.n = 0; diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 19e6a2dd0ef..32a6d3cd4a7 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -355,7 +355,7 @@ pub fn float_to_str_bytes_common ~[~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()); } diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index cc0e843b896..5fa0281dc93 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -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); diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index 51eb2505f55..299aa1175a7 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -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}; diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index f93fc1e81da..f0e64b1830e 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -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") } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 31905f6ccc7..df31fece5ea 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -340,7 +340,7 @@ pub fn find_stability>(mut metas: It) -> O "stable" => Stable, "frozen" => Frozen, "locked" => Locked, - _ => loop // not a stability level + _ => continue // not a stability level }; return Some(Stability { diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 11d9713af98..8d327de6d61 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -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); diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 640c7c220e5..3689b5c4999 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -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); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5c88c617950..4598bc04369 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1987,7 +1987,7 @@ impl Parser { } _ => self.unexpected() } - loop; + continue; } if self.expr_is_complete(e) { break; } match *self.token { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index bc1a4721207..2a3add059ce 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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, "'"); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 4c246bbe3f7..f7ed87f7a4f 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -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) { diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 6ce62ccd127..d7a7fe00185 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -130,7 +130,7 @@ fn main() { stdout); pos = 0; - loop; + continue; } // Complement other lines. diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index fff8a258479..99112985be6 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -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 } } } diff --git a/src/test/run-pass/break.rs b/src/test/run-pass/break.rs index 5903e421465..1ae77bc1eca 100644 --- a/src/test/run-pass/break.rs +++ b/src/test/run-pass/break.rs @@ -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)); } } diff --git a/src/test/run-pass/foreach-external-iterators-loop.rs b/src/test/run-pass/foreach-external-iterators-loop.rs index ced538e163e..37576874312 100644 --- a/src/test/run-pass/foreach-external-iterators-loop.rs +++ b/src/test/run-pass/foreach-external-iterators-loop.rs @@ -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; } diff --git a/src/test/run-pass/issue-2216.rs b/src/test/run-pass/issue-2216.rs index 4ad7d9500f6..f51a49e9c7b 100644 --- a/src/test/run-pass/issue-2216.rs +++ b/src/test/run-pass/issue-2216.rs @@ -21,7 +21,7 @@ pub fn main() { break 'bar; } } - loop 'foo; + continue 'foo; } x = 42; break; diff --git a/src/test/run-pass/loop-break-cont.rs b/src/test/run-pass/loop-break-cont.rs index 396946ce5a0..812089fd5a5 100644 --- a/src/test/run-pass/loop-break-cont.rs +++ b/src/test/run-pass/loop-break-cont.rs @@ -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; } diff --git a/src/test/run-pass/terminate-in-initializer.rs b/src/test/run-pass/terminate-in-initializer.rs index a2ba9e69bed..37cbc2b40de 100644 --- a/src/test/run-pass/terminate-in-initializer.rs +++ b/src/test/run-pass/terminate-in-initializer.rs @@ -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; } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 16070049151..9de4e295294 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -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; } }