Skip to content
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

bad error message regarding resolving generics #7087

Closed
kashbrti opened this issue Jan 16, 2025 · 1 comment
Closed

bad error message regarding resolving generics #7087

kashbrti opened this issue Jan 16, 2025 · 1 comment

Comments

@kashbrti
Copy link
Contributor

kashbrti commented Jan 16, 2025

when running the code below, the compiler complains about resolving the generics although the issue we're checking a field element has negative number of bits.

fn main() {
    let limbs: [Field; 4] = [0xea1742447ee9d92f9f18e1c80a481e, 0x3d89ad3d3ae85f3f482a08435c93ec, 0x1e9f, 0x1]; 
    validate_in_range::<4, 254>(limbs);
}

pub(crate) fn validate_in_range<let N: u32, let MOD_BITS: u32>(limbs: [Field; N]) {
    for i in 0..(N - 1) {
        limbs[i].assert_max_bit_size::<120>();
    }
    limbs[N - 1].assert_max_bit_size::<MOD_BITS - ((N - 1) * 120)>();
}
Image
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Jan 16, 2025
@kashbrti kashbrti changed the title Complaining about the generics although the issue is a bad index Complaining about resolving the generics although the issue we're checking a field element has negative number of bits Jan 16, 2025
@kashbrti kashbrti changed the title Complaining about resolving the generics although the issue we're checking a field element has negative number of bits bad error message regarding resolving generics Jan 16, 2025
@asterite
Copy link
Collaborator

asterite commented Feb 5, 2025

The error message in master is this now:

error: Could not determine array length `-106`, encountered error: `The value `-106` cannot fit into `numeric u32` which has a maximum size of `4294967295``
   ┌─ std/field/mod.nr:14:13
   │
14 │             BIT_SIZE < modulus_num_bits() as u32,
   │             --------
   │
   = Call stack:
     1. std/field/mod.nr:14:13

I guess that's the expected message, right?

It seems it was fixed by #7263 though I'm not sure why.

@asterite asterite closed this as completed Feb 5, 2025
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants