Move inclusive range check to validation

This commit is contained in:
Geoffry Song 2019-11-15 01:04:37 -08:00
parent 989cebc99c
commit a68aefdc46
5 changed files with 33 additions and 11 deletions

View file

@ -300,9 +300,6 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> (Option<CompletedMarker>,
let has_trailing_expression =
p.at_ts(EXPR_FIRST) && !(r.forbid_structs && p.at(T!['{']));
if !has_trailing_expression {
if op == T![..=] {
p.error("expected expression to end inclusive range");
}
// no RHS
lhs = m.complete(p, RANGE_EXPR);
break;