rust-analyzer: Proc macro server crashed
I don’t think this is a duplicate of the other macro issues, I haven’t seen this error message in them:
thread 'MacroExpander' panicked at 'assertion failed: `(left != right)`
left: `0`,
right: `0`', crates/proc-macro-srv/src/abis/abi_1_63/proc_macro/bridge/handle.rs:22:9
stack backtrace:
0: rust_begin_unwind
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
4: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::handle::InternedStore<T>::new
5: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::HandleStore<S>::new
6: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::run_server
7: proc_macro_srv::abis::abi_1_63::proc_macro::bridge::server::<impl proc_macro_srv::abis::abi_1_63::proc_macro::bridge::client::Client<(proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream,proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream),proc_macro_srv::abis::abi_1_63::proc_macro::TokenStream>>::run
8: proc_macro_srv::abis::abi_1_63::Abi::expand
9: proc_macro_srv::abis::Abi::expand
10: proc_macro_srv::ProcMacroSrv::expand
11: proc_macro_srv::cli::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Similarly to the other issues, the entire macro site is marked as an error with failed to write request: Broken pipe (os error 32).
Happens with at least all serde derives, tracing #[instrument], #[async_trait] and tonic’s include_proto!.
rust-analyzer version: 0.0.0 (427061da1 2022-06-19)
rustc version: rustc 1.63.0-nightly (bb8c2f411 2022-06-19) on Arch Linux
relevant settings: rust-analyzer.procMacro.attributes.enable is true, no macros have been ignored.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 19
- Comments: 28 (15 by maintainers)
Commits related to this issue
- Downgrade toolchain See: https://github.com/rust-lang/rust-analyzer/issues/12600 — committed to tetrahedron341/pc-os by tetrahedron341 2 years ago
- Downgrade toolchain to avoid a rust-analyzer bug https://github.com/rust-lang/rust-analyzer/issues/12600 — committed to jeromerobert/starpu-tcp by jeromerobert 2 years ago
- Auto merge of #12747 - jonas-schievink:proc-macro-abi-1.63, r=jonas-schievink fix: Update 1.61 proc macro ABI to match rustc This updates us to the ABI used by rustc 1.63.0-beta.5, which will likely... — committed to rust-lang/rust-analyzer by bors 2 years ago
- Auto merge of #12747 - jonas-schievink:proc-macro-abi-1.63, r=jonas-schievink fix: Update 1.63 proc macro ABI to match rustc This updates us to the ABI used by rustc 1.63.0-beta.5, which will likely... — committed to rust-lang/rust-analyzer by bors 2 years ago
- Downgrade toolchain to avoid a rust-analyzer bug https://github.com/rust-lang/rust-analyzer/issues/12600 — committed to jeromerobert/starpu-tcp by jeromerobert 2 years ago
- Downgrade toolchain to avoid a rust-analyzer bug https://github.com/rust-lang/rust-analyzer/issues/12600 — committed to jeromerobert/starpu-tcp by jeromerobert 2 years ago
- Auto merge of #12795 - jonas-schievink:proc-macro-abi-1.64, r=jonas-schievink feat: Support the 1.64 nightly proc macro ABI Should resolve https://github.com/rust-lang/rust-analyzer/issues/12600 No... — committed to rust-lang/rust-analyzer by bors 2 years ago
- Downgrade toolchain See: https://github.com/rust-lang/rust-analyzer/issues/12600 — committed to tetrahedron341/pc-os by tetrahedron341 a year ago
The latest known-good pair is today’s nightly of both rustc and rust-analyzer. And from now on, rust nightlies contain a rust-analyzer proc-macro server that is guaranteed to use the same proc-macro bridge version as rustc, which the rust-analyzer extension will check for and use (as of today), so expect no more breakage of this kind 😃
You can read about all the details on fasterthanlime’s blog.
This workaround seems to work for me with VSCode:
rustup:rust-analyzernightly binary:settings.json, in therust-analyzer.server.pathsetting:@Galster-dev downgrading just hides the issue, it doesn’t fix it. To hide it you could also just disable the diagnostic.
This broke between 2022-06-18 and 2022-06-19.
Confirmed, looks like another ABI change. As a workaround you can downgrade to a nightly from around 2022-06-08.
I am pretty sure that rust-analyzer version doesn’t yet include the fix.
There are probably going to be a couple of other abi breakages in the near future. There are several PR’s affecting libproc_macro open at the moment.
Nightly indeed still seems to be broken, but beta is fixed. I think nightly already had some additional changes since beta branched (namely https://github.com/rust-lang/rust/pull/98188).
well 4cbf23c is exactly the commit id of the fix. Is the version number wrong?
I’m using rust toolchain
nightly-2022-06-08(as suggested higher up in this thread) with the latest release version of therust-analyzerVSCode extension (0.3.1140-standalone (7e2b983fd 2022-07-24)). All VSCode settings for rust-analyzer are the defaults. This error (or a related error) is still occurring with this combination - what is the latest known-good pairing of nightly rust and rust-analyzer version? Theatsamd-rslibraries make pretty heavy use of proc macros so I’m willing to use whatever tool versions necessary to have support until the larger issue here can be resolved.The error message in question:
Yes
Hello! I’ve been slowly downgrading using VS marketplace so I can tell this broke in release
0.4.1086Downgrading to0.4.1085seems to fix this issue (there is other error log related to proc macro server which I’m not gonna cover because it’s most likely already fixed)Ah yeah, the older version in rustup is likely just not showing the error message.
@flodiebold Where did you get the idea that I’m running x86 VSCode? I’m running ARM VSCode (from the Universal binary), ARM rust-analyzer, etc.:
Same issue as here, with the
failed to write request: Broken pipe (os error 32)resulting when rustup gets out-of-sync with the rust-analyzer binary.