diff options
| author | bors <bors@rust-lang.org> | 2013-10-02 02:31:29 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-10-02 02:31:29 -0700 |
| commit | d00c9269dce3a7925d7d0bf5edb64b3c6747c6af (patch) | |
| tree | 2446c316e34164e1b0795fb909de8951d503fe20 /src/libsyntax | |
| parent | 97cd495aca946d088e103d364d3be34f2bfaf1e1 (diff) | |
| parent | 4f67dcb24adb1e23f04e624fcbaf2328b82491b6 (diff) | |
| download | rust-d00c9269dce3a7925d7d0bf5edb64b3c6747c6af.tar.gz rust-d00c9269dce3a7925d7d0bf5edb64b3c6747c6af.zip | |
auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/format.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
7 files changed, 16 insertions, 9 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index d3a01401fdb..e697368009c 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -1068,12 +1068,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<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 { 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 4a384f864b0..79c330c4737 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/obsolete.rs b/src/libsyntax/parse/obsolete.rs index adf0c208da4..5a8563f963d 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -63,6 +63,7 @@ pub enum ObsoleteSyntax { ObsoleteTraitFuncVisibility, ObsoleteConstPointer, ObsoleteEmptyImpl, + ObsoleteLoopAsContinue, } impl to_bytes::IterBytes for ObsoleteSyntax { @@ -244,6 +245,11 @@ impl ParserObsoleteMethods for Parser { "empty implementation", "instead of `impl A;`, write `impl A {}`" ), + ObsoleteLoopAsContinue => ( + "`loop` instead of `continue`", + "`loop` is now only used for loops and `continue` is used for \ + skipping iterations" + ), }; self.report(sp, kind, kind_str, desc); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 4dd09cbcbd2..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 { @@ -2597,6 +2597,7 @@ impl Parser { "a label may not be used with a `loop` expression"); } + self.obsolete(*self.last_span, ObsoleteLoopAsContinue); let lo = self.span.lo; let ex = if self.token_is_lifetime(&*self.token) { let lifetime = self.get_lifetime(&*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, "'"); |
