Skip to content

Releases: noir-lang/noir

nightly-2024-05-10: chore(experimental): Add compiler option to enable the Elaborator (#5…

10 May 02:17
c8b70ac
Compare
Choose a tag to compare
…003)

# Description

## Problem\*

Working towards #4594 

## Summary\*

Adds a hidden compiler option `--use-elaborator` to enable the
experimental elaborator code to be run on a codebase.

This also connects the elaborator with `dc_crate` (and thus the cli flag
above) by filling in the stub for elaborating functions. Filling in the
stub required quite a bit of code but it was as usual just copied from
name resolution and type checking.

## Additional Context

Originally I wanted to connect the elaborator to more of the frontend
(e.g. resolve globals, types, traits, etc) but this already ballooned to
a large line count. To review I'd recommend reviewing the non-elaborator
portions first then just skimming through the elaborator portions since
they are copied from `Resolver::resolve_function`,
`Resolver::extract_meta`, `Resolver::intern_function`, and
`type_check_func`.

## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

nightly-2024-05-09: feat: add `Not` trait to stdlib (#4999)

09 May 02:17
95d4d13
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR adds a `Not` trait which is an equivalent of Rust's
`std::ops::Not` trait which represents a bitwise NOT.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

nightly-2024-05-08: feat: add support for u16/i16 (#4985)

08 May 02:06
e43661d
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves https://github.com/noir-lang/noir/issues/4908

## Summary\*

Adds cases for `u16`. `i16` was right there so added at the same time.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [x] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

---------

Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>

v0.29.0

06 May 14:07
2da2899
Compare
Choose a tag to compare
v0.29.0 Pre-release
Pre-release

0.29.0 (2024-05-03)

⚠ BREAKING CHANGES

  • use distinct return value witnesses by default (#4951)
  • Bit shift is restricted to u8 right operand (#4907)

Features

  • Add #[inline(tag)] attribute and codegen (#4913) (1ec9cdc)
  • Add de-sugaring for impl Trait in function parameters (#4919) (8aad2e4)
  • Add variable size sha256 (#4920) (dbfca58)
  • Bit shift is restricted to u8 right operand (#4907) (c4b0369)
  • Complex outputs from acir call (#4952) (2e085b9)
  • experimental: comptime globals (#4918) (8a3c7f1)
  • Handle BrilligCall opcodes in the debugger (#4897) (b380dc4)
  • Handle no_predicates attribute (#4942) (0ce04d3)
  • Handle empty response foreign calls without an external resolver (#4959) (0154bde)
  • Optimize array sets in if conditions (alternate version) (#4716) (a87c655)
  • Use distinct return value witnesses by default (#4951) (5f1b584)

Bug Fixes

  • Ban self-referential structs (#4883) (800f670)
  • Discard ref counts during unrolling (#4923) (91062db)
  • Ensure where clauses propagated to trait default definitions (#4894) (aaac0f6)
  • Move remove_if_else pass after second inlining (#4976) (96fb3e9)
  • Nested array equality (#4903) (0cf2e2a)
  • Require for all foldable functions to use distinct return (#4949) (d4c6806)
  • Use annotated type when checking declaration (#4966) (f7fa696)

nightly-2024-05-07: fix: Compute the correct slice length when coercing from a literal ar…

07 May 02:17
f3f1150
Compare
Choose a tag to compare
…ray of complex types (#4986)

# Description

## Problem\*

Resolves #4967

## Summary\*

There is a problem in the [array to slice
coercion](https://github.com/noir-lang/noir/blob/07930d4373a393146210efae69e6ec40171f047b/compiler/noirc_evaluator/src/ssa/ir/instruction/call.rs#L87)
code. When evaluating the coercion, it does not take into account that
for SSA, complex types such as tuples and structs are flattened,
resulting in an array representation with length of elements times the
size of the complex type (as a result of the flattening). This results
in the replacement slice having an incorrect size.

Then, because the slice has an inflated size, the code which decodes the
elements of the slice for printing or tracking (in the debugger) crashes
when it attempts to decode beyond the values that it has available.

## Additional Context

There are two additional minor changes introduced in this PR:

1. Removed the `Optional<>` for `PrintableType::Array`'s length. This
was introduced to be able to print slices (setting the length to
`None`), but those are now represented properly with
`PrintableType::Slice`.
2. Added support for printing slices.

Both are pretty small changes which I made while investigating the
issue, but I'm willing to send separate PRs for those if required.

I also expanded the existing test cases to verify both the coerced slice
length and printing of slices.

## Documentation\*

Check one:
- [X] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [X] I have tested the changes locally.
- [X] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

nightly-2024-05-06: fix: Move remove_if_else pass after second inlining (#4976)

06 May 02:15
96fb3e9
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

For the test added in this PR I bumped the `max_iter` in
`try_merge_only_changed_indices`. We then get the following panic:
```
The application panicked (crashed).
Message:  internal error: entered unreachable code: All Value::Instructions should already be known during inlining after creating the original inlined instruction. Unknown value v41 = Instruction { instruction: Id(76), position: 0, typ: Array([Numeric(Unsigned { bit_size: 32 })], 30) }
Location: compiler/noirc_evaluator/src/ssa/opt/inlining.rs:253
``` 
We have to inline immediately following mem2reg before extra
instructions are added by the remove_if_else pass.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.

nightly-2024-05-05: fix: Move remove_if_else pass after second inlining (#4976)

05 May 02:16
96fb3e9
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

For the test added in this PR I bumped the `max_iter` in
`try_merge_only_changed_indices`. We then get the following panic:
```
The application panicked (crashed).
Message:  internal error: entered unreachable code: All Value::Instructions should already be known during inlining after creating the original inlined instruction. Unknown value v41 = Instruction { instruction: Id(76), position: 0, typ: Array([Numeric(Unsigned { bit_size: 32 })], 30) }
Location: compiler/noirc_evaluator/src/ssa/opt/inlining.rs:253
``` 
We have to inline immediately following mem2reg before extra
instructions are added by the remove_if_else pass.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.

nightly-2024-05-05: fix: Move remove_if_else pass after second inlining (#4976)

05 May 02:16
96fb3e9
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

For the test added in this PR I bumped the `max_iter` in
`try_merge_only_changed_indices`. We then get the following panic:
```
The application panicked (crashed).
Message:  internal error: entered unreachable code: All Value::Instructions should already be known during inlining after creating the original inlined instruction. Unknown value v41 = Instruction { instruction: Id(76), position: 0, typ: Array([Numeric(Unsigned { bit_size: 32 })], 30) }
Location: compiler/noirc_evaluator/src/ssa/opt/inlining.rs:253
``` 
We have to inline immediately following mem2reg before extra
instructions are added by the remove_if_else pass.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.

nightly-2024-05-04: fix: Move remove_if_else pass after second inlining (#4976)

04 May 02:12
96fb3e9
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

For the test added in this PR I bumped the `max_iter` in
`try_merge_only_changed_indices`. We then get the following panic:
```
The application panicked (crashed).
Message:  internal error: entered unreachable code: All Value::Instructions should already be known during inlining after creating the original inlined instruction. Unknown value v41 = Instruction { instruction: Id(76), position: 0, typ: Array([Numeric(Unsigned { bit_size: 32 })], 30) }
Location: compiler/noirc_evaluator/src/ssa/opt/inlining.rs:253
``` 
We have to inline immediately following mem2reg before extra
instructions are added by the remove_if_else pass.

## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.

nightly-2024-05-03: fix: Use annotated type when checking declaration (#4966)

03 May 02:15
f7fa696
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves https://github.com/noir-lang/noir/issues/4742

## Summary\*



## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** 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.