Skip to content

macro-error for macros from external crates with rust-analyzer 1.94.0 #21224

@jonsetzky

Description

@jonsetzky

Similar/related issue? #21216

Context

Both rust-analyzer versions produce the error.

version
rust-analyzer 0.3.2702-standalone (d646b23f00 2025-11-30)
0.4.2708-standalone (2cbf3587d3 2025-12-05)
rustc 1.94.0-nightly (ba86c0460 2025-12-06)

editor: VSCode 1.106.3

relevant settings: Default extension settings.

Problem reproduction

code snippet to reproduce:

// tests/test.rs
use test_case::test_case;
#[test_case(10, 10 ; "test")]
fn it_works(input: i32, expected: i32) {
    assert_eq!(input, expected);
}

Expected behaviour: rust-analyzer doesn't show any errors.

Actual behaviour: rust-analyzer shows macro-error for the test_case macro:

failed to write request: The length of a sequence must be known

The problem seemed to occur for all macros that come from other crates as using parametrized or rstest instead of test_case didn't work either.

Workaround

Using stable rustc (1.91.1 (ed61e7d7e 2025-11-07)) for rust-analyzer makes the problem disappear:

"rust-analyzer.server.extraEnv": {
    "RUSTUP_TOOLCHAIN": "stable"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions