-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 0.1.42 breaks code with #![deny(trivial_numeric_casts)] #6
Comments
Sure, we can probably just add |
This deny is useful so I think we may just tune the macro a bit, instead of |
You're welcome to experiment with different approaches, of course. |
Ok, I can try. However, I'm not really familiar with macros because I'm new in rust and I just wanted my code to compile 😄 , but the whole last month I'm just fixing issues one by one in my dependencies... And this one seems to be really hard. Any help about how can I debug macro or something? Because I have no idea how to do it. |
I went ahead and allowed the warning in #7, if you'd like to test it on your code. We can followup with a different approach if you figure out something better. Debugging macros is kind of a pain. On nightly rustc, you can use |
7: Use i64, and allow trivial_numeric_casts r=cuviper a=cuviper The traits are implemented from 64-bit values, and we don't want to lose any bits when comparing on platforms with smaller `isize`. Simple enum expressions may have no explicit type, like `A = 1`, so then the derived `1 as i64` is inferred like `1i64 as i64`, a trivial numeric cast. But it's quite possible that other expressions could have explicit types, so we can't just assign it directly either. The simple solution is to just allow the `trivial_numeric_casts` in derived code. Fixes #6.
Minimal reproducible example
Cargo.toml
main.rs
Error:
Our project depends heavily on this
deny
attribute so disable it is a no-no. Currently we usenum-derive = "=0.1.41"
but I hope we can switch to higher version. Is seems to be an easy fix.The text was updated successfully, but these errors were encountered: