rust-analyzer: proc macro `*` not expanded: proc macro not found

rust-analyzer version: 6fc5c3cd2 2022-06-20

rustc version: (latest stable) rustc 1.61.0 (fe5b13d68 2022-05-18)

Since last week, rust analyzer shows several errors for proc macros not found including sometimes cfg_attr in the header of some files where there’s no apparent cfg_attr.

Until yesterday’s update the errors used to go away after a while but with yesterdays version and with latest pre-release the errors stay.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 38
  • Comments: 32 (18 by maintainers)

Most upvoted comments

@juanmait @alice-i-cecile That version is older than the fix for the tokio::main problem. If you install the pre-release, I’d expect you to get a newer version though (2022-06-20 or now 2022-06-23 with extension version 0.4.1103).

Hi, I’m currently seeing this with clap:

E.g. with the stub program:

use clap::Parser;

#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
struct Args {
}

fn main() {

}

Cargo.toml: clap = { version = "3.2.6", features = ["derive"]}

Then I get this error from rust-analyzer:

proc macro clap not expanded: proc macro not found

(Although the code itself builds fine without any errors/warnings via cargo)

rustc 1.61.0 (fe5b13d68 2022-05-18) rust-analyzer: v0.4.1102 (also saw the same thing with the stable release before trying this pre-release)

@mattbradbury Nothing broke it, it never worked. We just didn’t show the error as prominently before.

@alfuhigi Your problem is the exact opposite of @mattbradbury. You are using an arm64 version of vscode, but you are using an x86_64 version of rustc. Switching to the aarch64-apple-darwin version should work.

@flodiebold Actually it just worked after doing a simple extension reload 👍🏼 Thanks 😃