-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
rust-analyzer version: 0.4.2625-standalone
rustc version: 1.90.0 (1159e78c4 2025-09-14)
editor or extension: vscode, pre-release (0.4.2625)
repository link: https://github.com/jni-rs/jni-rs/tree/rust-analyzer-macro-expected-punct-bug
I've been working on a define_reference_type!
macro_rules
macro for the jni
crate which is building and working as expected when built with cargo+rustc but I'm finding that it's not practical to use while rust-analyzer hits these "expected punct: `,`" errors and then I also can't use rust-analyzer to expand the macro for debugging.
In the linked jni
branch there is an standalone version of the macro under examples/test-macro-parser.rs
where the majority of the macro is identical to the real one that fails but the final step that generates the jni-specific code is stubbed for testing. Since this doesn't trigger rust-analyzer issues that seems to suggest that the issue is related to the final 'gen' step in the macro.
In the linked branch i've tried stripping out a bunch of the gen/emit code in the real macro too such that it still compiles but also still triggers the rust-analyzer error.
In vscode the error can be seen in any of the src/objects/jfoo.rs
files that use the define_reference_type
macro. Such as src/objects/jthrowable.rs
where I've also tried stubbing out a more minimal invocation of the macro in an attempt to simplify the reproduction.