Rust Analyzer shows nonexistent error in VS Code (Deserialize macro not expaned)

A fresh new install of Ubuntu, VS Code (1.85.2) with plugins Rust-analyzer (0.3.1815) & CodeLLDB (1.10.0).

A new empty crate with just Rust analyzer shows me error in #[derive(Deserialize), whist cargo c shows no such error and runs the program normally. What is going on?


name = "heatmap"
version = "0.1.0"
edition = "2021"

geo = "0.27"
serde = {version = "1", features = ["derive"] }
serde_json = "1.0"
csv = "1.3"

use std::{collections::HashMap, error::Error};

use csv::Reader;
use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct CsvRow {
    lon: f32,
    lat: f32

fn main() -> Result<(), Box<dyn Error>> {
    let mut rd = Reader::from_path("input_path.csv")?;
    let hm: HashMap<(i32, i32), u32> = HashMap::new();
    for r in rd.deserialize() {
        let r: CsvRow = r?;
        let x = (r.lon,;



When I run in VS Code, the error disappears, but as soon as I press Ctrl+S, it reappears.

Here's the error. What's going on, how to fix this?

That's an error in rust-analyzer itself. Usually restarting vs code will fix it.


Yes, it disappeared, thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.