Rust-analyzer shows an error when using negative numeric constants in BSN macros
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version and features
Latest main (https://github.com/bevyengine/bevy/commit/638c5dd29778c9ea718d44996b4832ed600c0169)
## What you did
```rust
#[derive(Component, Clone, Copy, Default)]
pub struct MyComponent(f32);
bsn! {
MyComponent(-0.1)
}
```
## What went wrong
Received a `expected Expr` error from rust-analyzer (but compiles fine).
## Additional information
Using braces around it does work:
```rust
bsn! {
MyComponent({-0.3})
}
```
Contributor guide
Research direction
Reproduce the issue with the provided Component and bsn! snippets in rust-analyzer, comparing the negative numeric constant with the braced form. Trace how BSN macro input is interpreted around MyComponent(-0.1); done means rust-analyzer accepts the unbraced form without an error while the example continues to compile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100