-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
rust-analyzer version
0.3.2702-standalone (VS Code extension, both release and pre-release)
rustc version
rustc 1.93.0-nightly (3ff30e7 2025-11-29)
Relevant settings
Default settings, proc-macros enabled.
Problem
rust-analyzer reports macro-error: unexpected token on #[test_case] attributes that use the semicolon syntax for naming test cases.
The code compiles and runs correctly with cargo test.
Minimal reproduction
// Cargo.toml: test-case = "3"
use test_case::test_case;
#[test_case(80, 1 ; "80 cols = 1 row boundary")]
#[test_case(160, 2 ; "160 cols = 2 row boundary")]
fn my_test(input: u16, expected: u16) {
assert_eq!(input / 80, expected);
}Expected behavior
No diagnostic errors — the test_case proc-macro should expand successfully.
Actual behavior
rust-analyzer shows macro-error: unexpected token on the first #[test_case] attribute in each stacked group. Subsequent attributes in the same group don't show errors.
Additionally, because the macro fails to expand, all symbols inside the test function show as "unknown type" (no type inference).
Notes
- The semicolon syntax
(args ; "name")is documentedtest_casesyntax for naming test cases - Only the first
#[test_case]in a stacked group shows the error cargo checkreports no errors- The issue appears in VS Code, VS Code Insiders, and VSCodium with both release and pre-release extensions
Workaround
"rust-analyzer.diagnostics.disabled": ["macro-error"]nazmulidris
Metadata
Metadata
Assignees
Labels
No labels