I'm using a couple of Rust macros in a relatively simple Rust CLI application. First, the tokio::main
macro, and secondly, the strum::Display
and strum::EnumIter
macros. The former allows my main
function to be async
, and the latter two allow me to convert enum
variants to/from string values, to provide user interaction.
- Windows 11
- Rust beta toolchain
1.88.0-beta.6 (873a06493 2025-05-10)
- VSCode
1.101.1
- Rust Analyzer extension for VSCode
0.3.2500
I'm getting an error on the code blocks that are utilizing macros, the main
function definition, and the enum
definition.
I can build and run the application perfectly fine, using cargo run
.
I used the Rust-Analyzer: Restart Server
option in VSCode, and that seems to have cleared up the issue for now. Is this a common issue that other people have come across, and shouldn't the extension be able to resolve this error without manually restarting it?
Does anyone know why I would get these errors in the first place?
NOTE: I am NOT doing any cross-compilation. I am either building natively on Windows 11 or using Docker Desktop to build a Linux (WSL2) container image, but that's it. There's no cross-compilation with the Rust toolchain.
tokio::main: Cannot create expander for ...\target\debug\deps\tokio_macros-cf9cdf6be2c8bed0.dll: unsupported metadata version 10
Cannot create expander for ...\target\debug\deps\strum_macros-509b7d3669cad3f0.dll: unsupported metadata version 10
#[tokio::main]
async fn main() {
loop {
let _ = select_function().await;
}
}
#[derive(strum::Display, EnumIter)]
enum UserOperation {
#[strum(to_string = "Category 1: Operation 01")]
Cat1Op1,
#[strum(to_string = "Category 1: Operation 02")]
Cat1Op2,
}