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

Panic when casting an array to a slice #7062

Closed
benesjan opened this issue Jan 14, 2025 · 0 comments · Fixed by #7073
Closed

Panic when casting an array to a slice #7062

benesjan opened this issue Jan 14, 2025 · 0 comments · Fixed by #7073
Assignees
Labels
bug Something isn't working

Comments

@benesjan
Copy link
Contributor

benesjan commented Jan 14, 2025

Bug

When I try to compile the following code:

fn main(args: [Field; 2]) {
    /// Safety: what?
    unsafe { store(args) };
}

pub unconstrained fn store(_: [Field]) {}

I get the following panic:

Image

When I make the function constrained:

fn main(args: [Field; 2]) {
    store(args);
}

pub fn store(_: [Field]) {}

all compiles fine.

So the bug seems to be present specifically when casting to a slice which is an argument to an unconstrained function.

Nargo Version

nargo version = 1.0.0-beta.1 noirc version = 1.0.0-beta.1+56ed6e16b975f91a (git version hash: 56ed6e16b975f91a, is dirty: false)

@benesjan benesjan added the bug Something isn't working label Jan 14, 2025
@benesjan benesjan changed the title Panic when casting array to slice Panic when casting an array to a slice Jan 14, 2025
@guipublic guipublic self-assigned this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants