Skip to content

Commit 2489baf

Browse files
committed
libsyntax: Fix parsing of "loop unsafe".
It was getting misparsed as a label.
1 parent b8845f0 commit 2489baf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,7 @@ class parser {
16001600

16011601
fn parse_loop_expr() -> @expr {
16021602
let opt_ident;
1603-
if is_ident(self.token) {
1603+
if is_ident(self.token) && !self.is_any_keyword(copy self.token) {
16041604
opt_ident = some(self.parse_ident());
16051605
self.expect(token::COLON);
16061606
} else {

src/test/run-pass/loop-unsafe.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Tests that "loop unsafe" isn't misparsed.
2+
3+
fn main() {
4+
loop unsafe {
5+
io::println("Hello world!");
6+
}
7+
}
8+

0 commit comments

Comments
 (0)