Skip to content

Detect when a macro without exclamation mark uses square brackets - #159996

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
estebank:issue-101490
Jul 27, 2026
Merged

Detect when a macro without exclamation mark uses square brackets#159996
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
estebank:issue-101490

Conversation

@estebank

@estebank estebank commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
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
   |
help: you might have meant to call a macro
   |
LL |     let _x = vec![1, 2, 3];
   |                 +

Fix #101490.

```
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
   |
help: you might have meant to call a macro
   |
LL |     let _x = vec![1, 2, 3];
   |                 +
```
@rustbot

rustbot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 27, 2026
@rustbot

rustbot commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, parser
  • compiler, parser expanded to 74 candidates
  • Random selection from 18 candidates

@oli-obk

oli-obk commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 0ad2a3b has been approved by oli-obk

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

Reason for tree closure: spurious failures

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 27, 2026
Detect when a macro without exclamation mark uses square brackets

```
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
   |
help: you might have meant to call a macro
   |
LL |     let _x = vec![1, 2, 3];
   |                 +
```

Fix rust-lang#101490.
rust-bors Bot pushed a commit that referenced this pull request Jul 27, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #158417 (Avoid ICE when cfg_eval recovers no item from derive input)
 - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`)
 - #159554 (feat: Update method signature of int_from_ascii)
 - #159637 (Some place analysis tweaks)
 - #159649 (Normalize region obligations before regionck)
 - #159961 (sanitize_standard_fds: Miri supports poll now)
 - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs)
 - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static)
 - #159804 (Expand docs for fs::metadata and fs::symlink_metadata)
 - #159821 (Update expect message using the recommended style in binary_heap module)
 - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver)
 - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
 - #159991 (std: make send_process_group_signal unsupported on VxWorks)
 - #159996 (Detect when a macro without exclamation mark uses square brackets)
@rust-bors
rust-bors Bot merged commit 661e2d1 into rust-lang:main Jul 27, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 27, 2026
rust-timer added a commit that referenced this pull request Jul 27, 2026
Rollup merge of #159996 - estebank:issue-101490, r=oli-obk

Detect when a macro without exclamation mark uses square brackets

```
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
   |
help: you might have meant to call a macro
   |
LL |     let _x = vec![1, 2, 3];
   |                 +
```

Fix #101490.
pull Bot pushed a commit to xtqqczze/rust-lang-miri that referenced this pull request Jul 28, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - rust-lang/rust#158417 (Avoid ICE when cfg_eval recovers no item from derive input)
 - rust-lang/rust#159085 (Fix decoding attributes of `SyntheticCoroutineBody`)
 - rust-lang/rust#159554 (feat: Update method signature of int_from_ascii)
 - rust-lang/rust#159637 (Some place analysis tweaks)
 - rust-lang/rust#159649 (Normalize region obligations before regionck)
 - rust-lang/rust#159961 (sanitize_standard_fds: Miri supports poll now)
 - rust-lang/rust#159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs)
 - rust-lang/rust#159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static)
 - rust-lang/rust#159804 (Expand docs for fs::metadata and fs::symlink_metadata)
 - rust-lang/rust#159821 (Update expect message using the recommended style in binary_heap module)
 - rust-lang/rust#159840 (Fix opaque type ICE in late lints under the next-generation trait solver)
 - rust-lang/rust#159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
 - rust-lang/rust#159991 (std: make send_process_group_signal unsupported on VxWorks)
 - rust-lang/rust#159996 (Detect when a macro without exclamation mark uses square brackets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid help suggestion when vec macro incorrectly used without !

3 participants