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

chore: Add comptime docs #5800

Merged
merged 15 commits into from
Aug 23, 2024
Merged

chore: Add comptime docs #5800

merged 15 commits into from
Aug 23, 2024

Conversation

jfecher
Copy link
Contributor

@jfecher jfecher commented Aug 22, 2024

Description

Problem*

Summary*

Most comptime features checked the "Documentation to be submitted in a separate PR" box. This is that PR.

Additional Context

Draft because I haven't documented each function in std::meta yet and want to see the docs preview.

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 and/or cargo fmt on default settings.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 22, 2024
Copy link
Contributor

github-actions bot commented Aug 22, 2024

Changes to Brillig bytecode sizes

Generated at commit: b5a7bd77ade9844cb86eb22ed45c54aa8f269d86, compared to commit: 38fe9dda111952fdb894df90a319c087382edfc9

There are no changes in circuit sizes

Copy link
Contributor

github-actions bot commented Aug 22, 2024

@jfecher jfecher requested a review from a team August 22, 2024 21:26
@jfecher jfecher marked this pull request as ready for review August 22, 2024 21:26
@TomAFrench
Copy link
Member

Looks good. Can we put the examples (especially the larger ones) into snippets to avoid them becoming stale?

@jfecher
Copy link
Contributor Author

jfecher commented Aug 23, 2024

@TomAFrench do we have a way to wrap tests like that? Since tests must be a single function currently.

I guess maybe they can be in their own private module in the stdlib?

@michaeljklein
Copy link
Contributor

@jfecher I would prefer to avoid adding them in the stdlib to avoid making nargo bigger. Why does each test need to be a single function?

@jfecher
Copy link
Contributor Author

jfecher commented Aug 23, 2024

Why does each test need to be a single function?

Because all #[test]s refer to a single function, while many of these examples have additional functions, structs, or traits. We could expose them all but then the test name would be exposed too. I wish we could have snippets in the docs be checked automatically without placing them in the stdlib as well.

Co-authored-by: Michael J Klein <michaeljklein@users.noreply.github.com>
docs/docs/noir/concepts/comptime.md Outdated Show resolved Hide resolved
docs/docs/noir/concepts/comptime.md Show resolved Hide resolved
docs/docs/noir/concepts/comptime.md Outdated Show resolved Hide resolved
docs/docs/noir/concepts/comptime.md Outdated Show resolved Hide resolved
jfecher and others added 4 commits August 23, 2024 11:07
Co-authored-by: Michael J Klein <michaeljklein@users.noreply.github.com>
Co-authored-by: Michael J Klein <michaeljklein@users.noreply.github.com>
@TomAFrench
Copy link
Member

do we have a way to wrap tests like that? Since tests must be a single function currently.

I'm not sure I follow. A snippet can contain arbitrary content so we just need to place the examples into a program which will be checked that it compiles successfully and then we can pull out the section of code we want to display. An example of this is the // docs:start:new_example snippet in noir_test_success/bounded_vec

@jfecher
Copy link
Contributor Author

jfecher commented Aug 23, 2024

Ok, I've moved as many snippets as I can through docs. The ones I did not move either:

  • Used println internally (execution ordering example)
  • Had text around the examples explaining specific items in the examples (x and y) which could implicitly break if the example were changed elsewhere without updating the docs (unquote example).

The make_trait_impl example is made a bit worse by the formatter and using crate::meta instead of std::meta but is still usable.

@jfecher jfecher enabled auto-merge August 23, 2024 19:51
@jfecher jfecher added this pull request to the merge queue Aug 23, 2024
Merged via the queue into master with commit 637febf Aug 23, 2024
46 of 47 checks passed
@jfecher jfecher deleted the jf/comptime-docs branch August 23, 2024 20:29
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 24, 2024
…5802)

chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 24, 2024
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 25, 2024
…5802)

chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 25, 2024
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 26, 2024
…5802)

chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 26, 2024
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 27, 2024
feat: Improve "type annotations needed" errors (noir-lang/noir#5830)
chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (noir-lang/noir#5421)
chore: delete wip fuzzing files that got accidentally added  (noir-lang/noir#5829)
chore: test ACVM `BigInt` (noir-lang/noir#5559)
fix(docs): Fix file paths for metaprogramming docs (noir-lang/noir#5826)
fix: bit shifting type checking (noir-lang/noir#5824)
feat: add Expr::as_method_call (noir-lang/noir#5822)
chore: Fix docs typo (noir-lang/noir#5821)
feat: add `UnresolvedType::is_field` and `Expr::as_assign` (noir-lang/noir#5804)
chore: Add docs for each comptime method (noir-lang/noir#5802)
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 27, 2024
feat: Improve "type annotations needed" errors (noir-lang/noir#5830)
chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (noir-lang/noir#5421)
chore: delete wip fuzzing files that got accidentally added  (noir-lang/noir#5829)
chore: test ACVM `BigInt` (noir-lang/noir#5559)
fix(docs): Fix file paths for metaprogramming docs (noir-lang/noir#5826)
fix: bit shifting type checking (noir-lang/noir#5824)
feat: add Expr::as_method_call (noir-lang/noir#5822)
chore: Fix docs typo (noir-lang/noir#5821)
feat: add `UnresolvedType::is_field` and `Expr::as_assign` (noir-lang/noir#5804)
chore: Add docs for each comptime method (noir-lang/noir#5802)
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization (noir-lang/noir#5810)
fix: honor function visibility in LSP completion (noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents (noir-lang/noir#5795)
feat: Explicit Associated Types & Constants (noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field` (noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check (noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon` (noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates (noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution (noir-lang/noir#5783)
chore: sanitize url's to only allow github (noir-lang/noir#5776)
chore: enable constant inputs for more blackbox (noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module (noir-lang/noir#5768)
TomAFrench added a commit that referenced this pull request Aug 27, 2024
* master: (21 commits)
  chore: crypto blackbox tests (#5614)
  feat: Improve "type annotations needed" errors (#5830)
  chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (#5421)
  chore: delete wip fuzzing files that got accidentally added  (#5829)
  chore: test ACVM `BigInt` (#5559)
  fix(docs): Fix file paths for metaprogramming docs (#5826)
  fix: bit shifting type checking (#5824)
  feat: add Expr::as_method_call (#5822)
  chore: Fix docs typo (#5821)
  feat: add `UnresolvedType::is_field` and `Expr::as_assign` (#5804)
  chore: Add docs for each comptime method (#5802)
  chore: Add comptime docs (#5800)
  fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (#5788)
  fix(acir_gen): Nested dynamic array initialization (#5810)
  fix: honor function visibility in LSP completion (#5809)
  feat: LSP completion now works better in the middle of idents (#5795)
  feat: Explicit Associated Types & Constants (#5739)
  feat: add `Expr::as_cast` and `UnresolvedType::is_field` (#5801)
  feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue (#5799)
  fix: do not use predicate for index in array operation, when the index is safe (#5779)
  ...
sirasistant added a commit to AztecProtocol/aztec-packages that referenced this pull request Aug 27, 2024
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
chore: crypto blackbox tests
(noir-lang/noir#5614)
feat: Improve "type annotations needed" errors
(noir-lang/noir#5830)
chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes
(noir-lang/noir#5421)
chore: delete wip fuzzing files that got accidentally added
(noir-lang/noir#5829)
chore: test ACVM `BigInt` (noir-lang/noir#5559)
fix(docs): Fix file paths for metaprogramming docs
(noir-lang/noir#5826)
fix: bit shifting type checking
(noir-lang/noir#5824)
feat: add Expr::as_method_call
(noir-lang/noir#5822)
chore: Fix docs typo (noir-lang/noir#5821)
feat: add `UnresolvedType::is_field` and `Expr::as_assign`
(noir-lang/noir#5804)
chore: Add docs for each comptime method
(noir-lang/noir#5802)
chore: Add comptime docs (noir-lang/noir#5800)
fix: Handle multiple entry points for Brillig call stack resolution
after metadata deduplication
(noir-lang/noir#5788)
fix(acir_gen): Nested dynamic array initialization
(noir-lang/noir#5810)
fix: honor function visibility in LSP completion
(noir-lang/noir#5809)
feat: LSP completion now works better in the middle of idents
(noir-lang/noir#5795)
feat: Explicit Associated Types & Constants
(noir-lang/noir#5739)
feat: add `Expr::as_cast` and `UnresolvedType::is_field`
(noir-lang/noir#5801)
feat: add `Expr` methods: as_comptime, as_unsafe, is_break, is_continue
(noir-lang/noir#5799)
fix: do not use predicate for index in array operation, when the index
is safe (noir-lang/noir#5779)
chore: Toggle underconstrained check
(noir-lang/noir#5724)
feat: Add `Expr::as_block` and `Expr::has_semicolon`
(noir-lang/noir#5784)
feat: LSP hover and go-to-definition for crates
(noir-lang/noir#5786)
fix(acvm): Clear ACIR call stack after successful circuit execution
(noir-lang/noir#5783)
chore: sanitize url's to only allow github
(noir-lang/noir#5776)
chore: enable constant inputs for more blackbox
(noir-lang/noir#5647)
chore: move sha2 functions into the `hash` module
(noir-lang/noir#5768)
END_COMMIT_OVERRIDE

---------

Co-authored-by: sirasistant <sirasistant@gmail.com>
Co-authored-by: Maxim Vezenov <mvezenov@gmail.com>
TomAFrench added a commit that referenced this pull request Aug 28, 2024
* master: (35 commits)
  fix!: Check unused generics are bound (#5840)
  chore(perf): Simplify poseidon2 algorithm  (#5811)
  chore: redo typo PR by nnsW3 (#5834)
  fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (#5760)
  chore(perf): Update to stdlib keccak for reduced Brillig code size (#5827)
  chore: crypto blackbox tests (#5614)
  feat: Improve "type annotations needed" errors (#5830)
  chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (#5421)
  chore: delete wip fuzzing files that got accidentally added  (#5829)
  chore: test ACVM `BigInt` (#5559)
  fix(docs): Fix file paths for metaprogramming docs (#5826)
  fix: bit shifting type checking (#5824)
  feat: add Expr::as_method_call (#5822)
  chore: Fix docs typo (#5821)
  feat: add `UnresolvedType::is_field` and `Expr::as_assign` (#5804)
  chore: Add docs for each comptime method (#5802)
  chore: Add comptime docs (#5800)
  fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (#5788)
  fix(acir_gen): Nested dynamic array initialization (#5810)
  fix: honor function visibility in LSP completion (#5809)
  ...
TomAFrench added a commit that referenced this pull request Aug 28, 2024
* master: (29 commits)
  fix!: Check unused generics are bound (#5840)
  chore(perf): Simplify poseidon2 algorithm  (#5811)
  chore: redo typo PR by nnsW3 (#5834)
  fix(sha256): Perform compression per block and utilize ROM instead of RAM when setting up the message block (#5760)
  chore(perf): Update to stdlib keccak for reduced Brillig code size (#5827)
  chore: crypto blackbox tests (#5614)
  feat: Improve "type annotations needed" errors (#5830)
  chore: enum dummy ID for `FuncId` in monomorphizer and docstring fixes (#5421)
  chore: delete wip fuzzing files that got accidentally added  (#5829)
  chore: test ACVM `BigInt` (#5559)
  fix(docs): Fix file paths for metaprogramming docs (#5826)
  fix: bit shifting type checking (#5824)
  feat: add Expr::as_method_call (#5822)
  chore: Fix docs typo (#5821)
  feat: add `UnresolvedType::is_field` and `Expr::as_assign` (#5804)
  chore: Add docs for each comptime method (#5802)
  chore: Add comptime docs (#5800)
  fix: Handle multiple entry points for Brillig call stack resolution after metadata deduplication (#5788)
  fix(acir_gen): Nested dynamic array initialization (#5810)
  fix: honor function visibility in LSP completion (#5809)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants