RA in VS Code highlights `#[tokio::main]`as error despite successful compilation with nightly Rust

โš“ Rust    ๐Ÿ“… 2025-08-25    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 5      

surdeus

โ€‹โ€‹Environment:โ€‹โ€‹

  • Rust toolchain: 1.91.0-nightly (809200ec9 2025-08-24)

  • Editor: VS Code (latest stable)

  • rust-analyzer: v0.3.2593,

  • tokio = { version = "1.47.1", features = ["full"] }

โ€‹โ€‹Issue:โ€‹โ€‹

The #[tokio::main]macro is highlighted as an error in VS Code by rust-analyzer(red underline, error hint: "tokio::main: proc macro server error: Cannot create expander for ~\target\debug\deps\tokio_macros-0db0bbc0b2211d25.dll: unsupported metadata version 10"). However, the project compiles and runs successfully via cargo build/runon the same toolchain. This occurs even in minimal async examples:

#[tokio::main]
async fn main() {
    println!("Hello, tokio!");
}

2025-08-25 224330

โ€‹โ€‹Question:โ€‹โ€‹

Is this a known issue with RA + nightly + Tokio? Are there workarounds beyond suppressing the diagnostic?

1 post - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed