diff options
| author | bors <bors@rust-lang.org> | 2017-11-04 06:59:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-11-04 06:59:29 +0000 |
| commit | 9acc3331e187d329d29a70c788c44e25a79edf45 (patch) | |
| tree | edc666d4c7ea78ab757aa096965f361a4ea1cbae /src/libsyntax/parse/parser.rs | |
| parent | a4541525d5aa2cbf9c15e89cde513792e22a0318 (diff) | |
| parent | e3b25a59421d471d3c198bdbed60c8ba60e62376 (diff) | |
| download | rust-9acc3331e187d329d29a70c788c44e25a79edf45.tar.gz rust-9acc3331e187d329d29a70c788c44e25a79edf45.zip | |
Auto merge of #45755 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests - Successful merges: #45548, #45610, #45639, #45669, #45681, #45718, #45722, #45739, #45746 - Failed merges:
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 5176379ee2f..424f46840ad 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3154,7 +3154,13 @@ impl<'a> Parser<'a> { // Parse: `for <src_pat> in <src_expr> <src_loop_block>` let pat = self.parse_pat()?; - self.expect_keyword(keywords::In)?; + if !self.eat_keyword(keywords::In) { + let in_span = self.prev_span.between(self.span); + let mut err = self.sess.span_diagnostic + .struct_span_err(in_span, "missing `in` in `for` loop"); + err.span_suggestion_short(in_span, "try adding `in` here", " in ".into()); + err.emit(); + } let expr = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; let (iattrs, loop_block) = self.parse_inner_attrs_and_block()?; attrs.extend(iattrs); |
