darling icon indicating copy to clipboard operation
darling copied to clipboard

panic from integer parsing

Open dimpolo opened this issue 9 months ago • 0 comments

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

dimpolo avatar May 11 '24 22:05 dimpolo