1685: fix error of RangeFrom in for-loop r=DJMcNab a=bravomikekilo

fix [issue-1542](https://github.com/rust-analyzer/rust-analyzer/issues/1542) @matklad 

Co-authored-by: bravomikekilo <bmk1221@126.com>
This commit is contained in:
bors[bot] 2019-08-15 05:49:13 +00:00
commit 5ed6a13a2c
5 changed files with 142 additions and 1 deletions

View file

@ -110,7 +110,19 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMar
p.bump();
block_expr(p, Some(m))
}
T!['{'] => block_expr(p, None),
T!['{'] => {
// test for_range_from
// fn foo() {
// for x in 0 .. {
// break;
// }
// }
if r.forbid_structs {
return None;
} else {
block_expr(p, None)
}
}
T![return] => return_expr(p),
T![continue] => continue_expr(p),
T![break] => break_expr(p, r),