Skip to content

Commit f8818cb

Browse files
committed
Fix incorrect semicolon suggestion
1 parent ad144ac commit f8818cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: src/libsyntax/ext/expand.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,9 @@ impl<'a> Parser<'a> {
10441044
);
10451045
err.note(&msg);
10461046
let semi_span = self.sess.source_map().next_point(span);
1047-
match self.sess.source_map().span_to_snippet(semi_span) {
1047+
1048+
let semi_full_span = semi_span.to(self.sess.source_map().next_point(semi_span));
1049+
match self.sess.source_map().span_to_snippet(semi_full_span) {
10481050
Ok(ref snippet) if &snippet[..] != ";" && kind_name == "expression" => {
10491051
err.span_suggestion_with_applicability(
10501052
semi_span,

Diff for: src/test/ui/macros/macro-context.stderr

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved k
1616
| ^^^^^^
1717
...
1818
LL | let i = m!();
19-
| ----- help: you might be missing a semicolon here: `;`
20-
| |
21-
| caused by the macro expansion here
19+
| ---- caused by the macro expansion here
2220
|
2321
= note: the usage of `m!` is likely invalid in expression context
2422

0 commit comments

Comments
 (0)