diff options
| author | David Wood <david@davidtw.co> | 2018-01-14 17:29:07 +0000 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2018-01-27 11:46:27 +0000 |
| commit | c71cec8834bf30032a8e49d2949f6d8d4080b639 (patch) | |
| tree | 49dc11292d287459c01aeddbd4c40240de9b2e16 /src/libsyntax/parse | |
| parent | c6e6428d1a13f61f5ffbe43697a21f3cd82cd01d (diff) | |
| download | rust-c71cec8834bf30032a8e49d2949f6d8d4080b639.tar.gz rust-c71cec8834bf30032a8e49d2949f6d8d4080b639.zip | |
end_point handling multibyte characters correctly.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index d393cab4718..e8e87e2854b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -704,13 +704,15 @@ impl<'a> Parser<'a> { expect.clone() }; (format!("expected one of {}, found `{}`", expect, actual), - (self.prev_span.next_point(), format!("expected one of {} here", short_expect))) + (self.sess.codemap().next_point(self.prev_span), + format!("expected one of {} here", short_expect))) } else if expected.is_empty() { (format!("unexpected token: `{}`", actual), (self.prev_span, "unexpected token after this".to_string())) } else { (format!("expected {}, found `{}`", expect, actual), - (self.prev_span.next_point(), format!("expected {} here", expect))) + (self.sess.codemap().next_point(self.prev_span), + format!("expected {} here", expect))) }; let mut err = self.fatal(&msg_exp); let sp = if self.token == token::Token::Eof { @@ -3190,7 +3192,7 @@ impl<'a> Parser<'a> { // return. This won't catch blocks with an explicit `return`, but that would be caught by // the dead code lint. if self.eat_keyword(keywords::Else) || !cond.returns() { - let sp = lo.next_point(); + let sp = self.sess.codemap().next_point(lo); let mut err = self.diagnostic() .struct_span_err(sp, "missing condition for `if` statemement"); err.span_label(sp, "expected if condition here"); |
