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

Cannot append slices #4609

Closed
signorecello opened this issue Mar 21, 2024 · 2 comments · Fixed by #4610
Closed

Cannot append slices #4609

signorecello opened this issue Mar 21, 2024 · 2 comments · Fixed by #4610
Assignees
Labels
bug Something isn't working

Comments

@signorecello
Copy link
Contributor

Aim

My goal is to append one slice to another

Expected Behavior

I expected it to return a new slice with both slices concatenated

Bug

I get an error in the form of:
ICE: should have slice capacity set at address v45 being loaded into v112

To Reproduce

  1. Use this snippet:
fn main(a: Field, b: pub Field) {
    let sl = [a, 1, 2, 3].as_slice();
    let sl2 = [b, 5, 6].as_slice();
    let sl3 = sl.append(sl2);
}
  1. Run nargo test with something such as:
#[test]
fn test_main() {
    main(0, 4);
}

Project Impact

None

Impact Context

No response

Workaround

None

Workaround Description

No response

Additional Context

No response

Installation Method

Binary (noirup default)

Nargo Version

nargo version = 0.25.0 noirc version = 0.25.0+cba1bff95911a7a1d3ea714735786db595a435cf (git version hash: cba1bff, is dirty: false)

NoirJS Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@signorecello signorecello added the bug Something isn't working label Mar 21, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Noir Mar 21, 2024
@vezenovm
Copy link
Contributor

vezenovm commented Mar 21, 2024

As as_slice moved to a builtin so we are not accurately handling it in the slice capacity tracker. Will push a fix soon.

@vezenovm
Copy link
Contributor

It is actually purely a type conversion error during simplification that was causing the capacity tracker to error out.

github-merge-queue bot pushed a commit that referenced this issue Mar 21, 2024
# Description

## Problem\*

Resolves #4609 

## Summary\*

We were not accurately converting the type from an array to a slice
during `AsSlice` SSA simplification. This led to the slice capacity
tracker not accurately tracking the slice size.

## Additional Context


## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Noir Mar 21, 2024
TomAFrench pushed a commit that referenced this issue Apr 3, 2024
# Description

## Problem\*

Resolves #4609 

## Summary\*

We were not accurately converting the type from an array to a slice
during `AsSlice` SSA simplification. This led to the slice capacity
tracker not accurately tracking the slice size.

## Additional Context


## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[Exceptional Case]** Documentation to be submitted in a separate
PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
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
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants