rust-analyzer: Regression(?): proc macro not expanded since v0.3.1091
I use NEAR Rust SDK crate (https://docs.rs/near-sdk/latest/near_sdk). I see “proc macro not expanded” errors everywhere after the update to v0.3.1091.
v0.3.1083 works fine.
rust-analyzer version: 0.3.1091
rustc version: rustc 1.61.0 (fe5b13d68 2022-05-18)
relevant settings: CARGO, RUSTUP_HOME, RUSTUP_HOME are empty
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 35 (24 by maintainers)
You will need to update rustc. Between the rustc version you are using and the latest one there has been an abi breaking change in the proc_macro implementation. Rust-analyzer 0.3.1091 updated for the new abi and thus broke support for the old abi (on nightly rustc at least) Rust-analyzer doesn’t attempt to support nightlies other than the latest.
Yes it would. The triple in the toolchain name is the triple for which the compiler itself is built and is thus the host triple.
Ah right, I was confusing toolchains with targets 😅
Then I guess it should also be possible to cross-compile to x86_64 with an aarch64 toolchain and aarch64 rust-analyzer build.
Right, but what I’m trying to say is that just because rustup says
stable-x86_64-apple-darwin (default), that wouldn’t automatically mean the host architecture is x86_64? Like, the target architecture shouldn’t matter, you should be able to cross-compile from aarch64 to x86_64, in which case rustc should build proc macros for aarch64.Unless rustup on M1 Mac installs aarch64 builds for compiling to aarch64, and x86 builds for compiling to x86. Which I guess would make some sense.
Or just point
rust-analyzer.server.pathto an x86_64 build of rust-analyzer.I think #12579 will fix that problem if/when we implement it.
It was my setup. I had x86_64 leftovers after migrating to aarch64 system.
I’ll hide the resolved comments here so we don’t lose track of the different people here, @sumerman if you can’t seem to figure out your new problem feel free top open a new issue for that.
After setting up
cargo pgx, expanding#[pg_extern]seems to work for me, both in stable and beta: