-
Notifications
You must be signed in to change notification settings - Fork 222
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
uint crate cannot create very large integers #388
Comments
hey @That3Percent this code generates a type #[derive(PartialEq, Eq, Hash)]
pub struct U4096(pub [u64; 64]);
... The problem is that rust implements these traits ( Maybe we should document this in the readme that currently only up to 2048 bits are supported. Would you mind submitting a PR? |
Actually, I think it's possible to manually implement these traits instead of deriving them. |
Yes, I think manually implementing the traits is the way to go here. |
I came back to this to try and optimize stable-hash which does a multiply of a large number and there seem to be at least two issues here. One is the aformentioned compiler hang, and one is invalid tokens generated by the macro. This produces a compiler hang: construct_uint! {
pub struct U4096(64);
} And this produces invalid tokens: construct_uint! {
pub struct U4160(65);
} Error:
|
And a third issue... This panics the compiler. construct_uint! {
pub struct U1088(17);
} With this panic:
|
interesting, thank you for digging into this, I believe this is due to how we use https://github.com/Vurich/crunchy/ unrolling |
This was fixed long time ago. See https://blog.rust-lang.org/2020/10/08/Rust-1.47.html#traits-on-larger-arrays
Works with rustc 1.63.0 (4b91a6ea7 2022-08-08)
Well it takes huge time to materialize the code and lots of time to compile it but it works.
This one is confirmed. Would you please file a new issue? |
Trying to create a
U4096
type with:Rust-analyzer produces various errors:
And trying to do
cargo check
seems to hang the compiler indefinitely.The text was updated successfully, but these errors were encountered: