You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling my macro bitfield, as shown in the code snippet below, I get a "generic arguments are not allowed on builtin types" error from rust-analyzer.
But the code compile without any error or warnings.
If I copy the generated code as outputted by cargo expand in my editor, I don't get the error.
code snippet to reproduce:
use bitfield::bitfield;bitfield!{structFoo([u8]);}
If the type in parentheses is a simple type, like u8 and not a slice like type, there is no error. A slice like type in parentheses is handled differently by the macro
You can also check the examples in the "examples" folder of the repo.
The text was updated successfully, but these errors were encountered:
From first look, I believe this is #18211. Note there is another syntax error.
Edit: To clarify, the parse error is the problem. rust-analyzer mis-parses the expression (value&1)as u8<<(i%bit_len) (which is indeed unparseable) as a generic argument to u8. I suspect the reason for this parsing error is that we don't handle none groups correctly.
ChayimFriedman2
changed the title
"generic arguments are not allowed on builtin types" error where there should be no error
r-a fails to parse as u8<< expression within macri
Jan 31, 2025
ChayimFriedman2
changed the title
r-a fails to parse as u8<< expression within macri
r-a fails to parse as u8<< expression within macro
Jan 31, 2025
rust-analyzer version:
rust-analyzer version: 0.3.2237-standalone
andrust-analyzer 0.3.2284-standalone
rustc version:
rustc 1.85.0-nightly (7f75bfa1a 2024-12-30)
editor or extension:
Both VSCode and Neovim
repository link (if public, optional):
https://github.com/dzamlo/rust-bitfield/
When calling my macro
bitfield
, as shown in the code snippet below, I get a "generic arguments are not allowed on builtin types" error from rust-analyzer.But the code compile without any error or warnings.
If I copy the generated code as outputted by
cargo expand
in my editor, I don't get the error.code snippet to reproduce:
If the type in parentheses is a simple type, like u8 and not a slice like type, there is no error. A slice like type in parentheses is handled differently by the macro
You can also check the examples in the "examples" folder of the repo.
The text was updated successfully, but these errors were encountered: