Ted Driggs

Results 156 comments of Ted Driggs

This isn’t a `darling` bug - this is the behavior of Rust ([source](https://users.rust-lang.org/t/why-are-negative-value-literals-expressions/43333)).

`darling` has been burned in the past by attempting to go too far beyond what was supported by the underlying libraries - see the currently-open discussion about how to deal...

@greyblake for the `nutype` use-case, do you specifically need the `min` and `max` values to be literals, or do you need `Expr` that can be used in `const` positions? Enabling...

> At the moment nutype parses only literals, but I plan to extend it to support Expr / TokenStream as well for arbitrary things (e.g. constants). I’m not sure I...

Right, that makes sense. What I'm suggesting is that you could generate code like this: ```rust struct Percentage(i18); impl Percentage { const MIN: i8 = 100; const MAX: i8 =...

I went to implement this fix, and was surprised to discover that `syn` is already exposing negative integers as a single `Lit` token without needing me to handle unary operations....

@ijackson do you recall if there was a reason we didn't do this before? Was it causing problems with type inference?

@DCNick3 can you make a PR with that change for @ijackson to test against?

Good catch. Looks like that's a documentation issue; it's definitely not an `Option` [in the macro](https://github.com/TedDriggs/darling/blob/master/core/src/codegen/from_variant_impl.rs#L55).

Yes, that sounds reasonable to me.