Description
- editor: vscode (official build, version 1.52.0, commit 940b5f4bb5fa47)
- operating system: Arch Linux
- rust-analyzer extension:
matklad.rust-analyzer
v0.2.408 - rustc: 1.50.0-nightly (803c60218 2020-12-13)
I have a workspace with two crates defining various proc macros and one crate using them. I don't use any proc macros from crates outside this workspace. I only use derive macros and function-like macros, and the derive macros don't seem to be affected.
About half of the function-like proc macro invocations result in the error proc macro returned error: Cannot perform expansion for say: error String("internal error: entered unreachable code")
(with the name of the relevant macro in place of "say"):
When I close vscode, delete the "target" directory, and reopen vscode, the same invocations produce errors every time. Whether the error occurs seems to have some strange relationship with the tokens passed into the macro. For instance, this is okay:
say!(sink, (), "Could you rephrase? I don't know if you want to ");
But this errors:
say!(sink, (), ":");
The difference in this case seems to be that the source of the string in the latter is exactly one byte long. ":"
, "C"
, and " "
all error, for instance, but "::"
, ""
, "ü"
, and "\n"
don't. But that's just in this case. This, for instance, also errors despite having no one-byte string literals:
say!(sink, &*world, "or <>.", current_verbs.last().unwrap());
Which macro is being called and where and in what file the invocation is haven't made a difference in my experiments. When editing, the feedback on whether or not the error is triggered is instantaneous, even without saving.
The error only seems to occur, at least visibly, with the latest version of the extension, v0.2.408. If I downgrade to v0.2.400, I stop getting the red squiggly lines.
The project isn't public, and I haven't managed to create a minimal reproduction, but it's a personal project, so I could send a copy privately to a trusted rust-analyzer contributor if you need it.