mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Rollup merge of #101502 - TaKO8Ki:do-not-suggest-semicolon-for-macro-without-exclamation-mark, r=wesleywiser
Do not suggest a semicolon for a macro without `!` Fixes a regression in #101490
This commit is contained in:
commit
c365ce3ffd
@ -1977,6 +1977,9 @@ impl<'a> Parser<'a> {
|
|||||||
open_delim_span: Span,
|
open_delim_span: Span,
|
||||||
) -> PResult<'a, ()> {
|
) -> PResult<'a, ()> {
|
||||||
if self.token.kind == token::Comma {
|
if self.token.kind == token::Comma {
|
||||||
|
if !self.sess.source_map().is_multiline(prev_span.until(self.token.span)) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
let mut snapshot = self.create_snapshot_for_diagnostic();
|
let mut snapshot = self.create_snapshot_for_diagnostic();
|
||||||
snapshot.bump();
|
snapshot.bump();
|
||||||
match snapshot.parse_seq_to_before_end(
|
match snapshot.parse_seq_to_before_end(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: expected one of `.`, `?`, `]`, or an operator, found `,`
|
error: expected one of `.`, `?`, `]`, or an operator, found `,`
|
||||||
--> $DIR/do-not-suggest-suggest-semicolon-before-array.rs:5:5
|
--> $DIR/do-not-suggest-semicolon-before-array.rs:5:5
|
||||||
|
|
|
|
||||||
LL | [1, 3)
|
LL | [1, 3)
|
||||||
| ^ ^ help: `]` may belong here
|
| ^ ^ help: `]` may belong here
|
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
let _x = vec[1, 2, 3]; //~ ERROR expected one of `.`, `?`, `]`, or an operator
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
error: expected one of `.`, `?`, `]`, or an operator, found `,`
|
||||||
|
--> $DIR/do-not-suggest-semicolon-between-macro-without-exclamation-mark-and-array.rs:2:19
|
||||||
|
|
|
||||||
|
LL | let _x = vec[1, 2, 3];
|
||||||
|
| ^ expected one of `.`, `?`, `]`, or an operator
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
error: expected `;`, found `[`
|
error: expected `;`, found `[`
|
||||||
--> $DIR/suggest-suggest-semicolon-before-array.rs:8:5
|
--> $DIR/suggest-semicolon-before-array.rs:8:5
|
||||||
|
|
|
|
||||||
LL | [1, 3]
|
LL | [1, 3]
|
||||||
| ^
|
| ^
|
Loading…
Reference in New Issue
Block a user