bevy/crates/bevy_macro_utils/src
Emerson Coskey fb2d79ad60
Better macro errors for get_struct_fields (#17639)
# Objective

- Currently, the error span for `get_struct_field` when encountering an
enum or union points to the macro invocation, rather than the `enum` or
`union` token. It also doesn't mention which macro reported the error.

## Solution

- Report the correct error span
- Add parameter for passing in the name of the macro invocation

## Testing

Bevy compiles fine with this change

## Migration Guide

```rs
// before
let fields = get_struct_fields(&ast.data);

// after
let fields = get_struct_fields(&ast.data, "derive(Bundle)");
```

---------

Co-authored-by: Chris Russell <8494645+chescock@users.noreply.github.com>
2025-05-26 16:57:03 +00:00
..
attrs.rs Moved fq_std from bevy_reflect_derive to bevy_macro_utils (#9956) 2023-10-02 00:22:57 +00:00
bevy_manifest.rs Fix warnings and errors reported on Rust beta (#19294) 2025-05-19 23:56:48 +00:00
fq_std.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00
label.rs Remove upcasting methods + Cleanup interned label code (#18984) 2025-05-26 15:38:12 +00:00
lib.rs Internalize BevyManifest logic. Switch to RwLock (#18263) 2025-03-12 00:46:01 +00:00
shape.rs Better macro errors for get_struct_fields (#17639) 2025-05-26 16:57:03 +00:00
symbol.rs Add core and alloc over std Lints (#15281) 2024-09-27 00:59:59 +00:00