Fix incorrect semicolon suggestion

This commit is contained in:
Esteban Küber 2018-10-24 12:52:24 -07:00
parent ad144ac3c1
commit f8818cbf8f
2 changed files with 4 additions and 4 deletions

View File

@ -1044,7 +1044,9 @@ pub fn ensure_complete_parse(&mut self, macro_path: &Path, kind_name: &str, span
);
err.note(&msg);
let semi_span = self.sess.source_map().next_point(span);
match self.sess.source_map().span_to_snippet(semi_span) {
let semi_full_span = semi_span.to(self.sess.source_map().next_point(semi_span));
match self.sess.source_map().span_to_snippet(semi_full_span) {
Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => {
err.span_suggestion_with_applicability(
semi_span,

View File

@ -16,9 +16,7 @@ LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved k
| ^^^^^^
...
LL | let i = m!();
| ----- help: you might be missing a semicolon here: `;`
| |
| caused by the macro expansion here
| ---- caused by the macro expansion here
|
= note: the usage of `m!` is likely invalid in expression context