rust-lang / rust-lang/rust-analyzer

Unexpected token in input (macro-error)

Open
#17,528 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macro C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: 0.3.2020

rustc version: 1.75.0

editor or extension: vscode

relevant settings: None

repository link (if public, optional): https://github.com/VaRusLAN/rust-analyzer-bug

code snippet to reproduce:

use redis_module::{redis_module, Context, RedisString, Status};

redis_module! {
    name: "Test",
    version: 1.0,
    allocator: (redis_module::alloc::RedisAlloc, redis_module::alloc::RedisAlloc),
    data_types: [],
    init: module_init,
    deinit: module_deinit,
    commands: []
}

fn module_init(_: &Context, args: &Vec<RedisString>) -> Status {
    Status::Ok
}

fn module_deinit(_: &Context) -> Status {
    Status::Err
}

image
This project compiles just fine.
Since version 0.3.1992 I get this error in my projects. That never happened before. Version 0.3.1983 does not have this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the macro invocation and reproduction project linked in the issue, using the reported rust-analyzer versions 0.3.2020, 0.3.1992, and 0.3.1983 to compare behavior. Trace why the redis_module! input produces an unexpected-token diagnostic even though the project compiles; done means the valid example no longer shows that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.