TedDriggs / darling

A Rust proc-macro attribute parser
MIT License
1.02k stars 66 forks source link

panic from integer parsing #289

Closed dimpolo closed 6 months ago

dimpolo commented 6 months ago

When parsing something like: number = 1000 into a u8 I'm getting:

error: proc-macro derive panicked                                                                                                                                                  
    = help: message: called `Result::unwrap()` on an `Err` value: Error("number too large to fit in target type")

This presumably comes from this unwrap: https://github.com/TedDriggs/darling/blob/78f3d11e76b5f63c47a453daa679956f1507af43/core/src/from_meta.rs#L231

Quoting from the docs:

... darling prefers not to fail on the first error it encounters, instead doing as much work as it can, accumulating errors into a single report.

It would be great to replace the unwrap with the usual error handling

TedDriggs commented 6 months ago

Agreed; that should be updated. Not sure why I currently have it panicking.