Skip to content

fix(doc): analyze sub-modules imports before self#10390

Merged
asterite merged 7 commits intomasterfrom
ab/nargo-docs-tiny-fix
Nov 10, 2025
Merged

fix(doc): analyze sub-modules imports before self#10390
asterite merged 7 commits intomasterfrom
ab/nargo-docs-tiny-fix

Conversation

@asterite
Copy link
Collaborator

@asterite asterite commented Nov 5, 2025

Description

Problem

nargo doc on noir_base64 would crash

Summary

When a module has pub use foo::bar, the way nargo doc works (and this is how rustdoc works too) is:

  • If the publicly exported item can only be accessed via this export, then it's included right under the module that exports it. You can see this in action in the std::ops module where all the traits are actually exposed via a re-export
  • Otherwise, the item is shown as a re-export, like here

At one point we also keep track of a module's imports. We process these at the end, so we remove from the HashMap that associates modules with imports, because we'll traverse modules exactly once.

The problem was that because a re-exported module could be added to the module we were processing, it would be re-analyzed, and remove would panic. The solution is to process sub-modules before processing the current module.

This PR also includes an optimization to avoid creating Modules for a dependency multiple times: it was taking a long time to run nargo doc on noir-contracts, but now it works (it takes some times, but at least it ends).

And a couple more things:

  • modules and contracts are now distinguished, so a module Foo will show up as "Module Foo" while a contract will show up as "Contract Foo".
  • lists (ul) were styled across the entire docs to remove their bullets, but bullets still need to show up in user comments. There's a small CSS fix here to only style the docs layout lists, not user comments lists.

Additional Context

I then ran nargo doc on a few more projects, it works fine an all of them. I'm thinking that it would be nice to eventually run nargo doc on CI on some of the external projects to make sure it works on all of them, but for now maybe not because it could cause slowdowns (to us).

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.

@asterite asterite requested a review from a team November 5, 2025 20:05
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Execution Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: a5a341f Previous: 1739efd Ratio
rollup-checkpoint-merge 0.004 s 0.003 s 1.33
sha512-100-bytes 0.062 s 0.051 s 1.22

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.

Benchmark suite Current: a5a341f Previous: 1739efd Ratio
test_report_zkpassport_noir-ecdsa_ 3 s 1 s 3

This comment was automatically generated by workflow using github-action-benchmark.

CC: @TomAFrench

@asterite asterite force-pushed the ab/nargo-docs-tiny-fix branch from 8631180 to 976b00c Compare November 5, 2025 20:10
@asterite asterite changed the title fix(doc): get instead of remove fix(doc): analyze sub-modules imports before self Nov 5, 2025
@jfecher jfecher added this pull request to the merge queue Nov 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 10, 2025
@asterite asterite added this pull request to the merge queue Nov 10, 2025
Merged via the queue into master with commit e2fd76d Nov 10, 2025
278 of 284 checks passed
@asterite asterite deleted the ab/nargo-docs-tiny-fix branch November 10, 2025 15:01
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 11, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(brillig_gen): Switch to iterative variable liveness
(noir-lang/noir#10460)
feat: remove unnecessary mutation of blackbox functions during
flattening (noir-lang/noir#10182)
chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks
with… (noir-lang/noir#10461)
chore: green light for acir (native_types) audit
(noir-lang/noir#10381)
chore: lock Cargo.lock in cargo-binstall
(noir-lang/noir#10459)
fix(acir-gen): Use the side effect variable in `slice_pop_back`
(noir-lang/noir#10455)
fix: correct location for out of bounds match case integer
(noir-lang/noir#10454)
fix: Defunctionalize foreign functions in pre-SSA pass over mAST
(noir-lang/noir#10160)
fix: use unit for fmtstr without variables
(noir-lang/noir#10456)
chore(docs): Update tinyjs app tutorial for versioned docs
(noir-lang/noir#10453)
fix(frontend): Resolve to correct type on fmtstr interpolation error
(noir-lang/noir#10450)
fix: avoid producing duplicate private error messages
(noir-lang/noir#10449)
chore(docs): update dependencies and installation instructions in NoirJS
tutorial and examples (noir-lang/noir#10400)
fix(compiler): Improve error message for impl on primitive types
(noir-lang/noir#10430)
(noir-lang/noir#10442)
chore: get trait as non-mut
(noir-lang/noir#10447)
chore(frontend): Tuple dereference chain unit test and minor method
reorg (noir-lang/noir#10410)
fix(doc): analyze sub-modules imports before self
(noir-lang/noir#10390)
chore: green light for blackbox_solver audit
(noir-lang/noir#10372)
chore: use `get_last_condition` in `link_condition`
(noir-lang/noir#10424)
chore: bump external pinned commits
(noir-lang/noir#10443)
feat: primitive types doc comments
(noir-lang/noir#10432)
chore(frontend): Trait impl Self path unit tests
(noir-lang/noir#10437)
END_COMMIT_OVERRIDE
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 11, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(brillig_gen): Switch to iterative variable liveness (noir-lang/noir#10460)
feat: remove unnecessary mutation of blackbox functions during flattening (noir-lang/noir#10182)
chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks with… (noir-lang/noir#10461)
chore: green light for acir (native_types) audit (noir-lang/noir#10381)
chore: lock Cargo.lock in cargo-binstall (noir-lang/noir#10459)
fix(acir-gen): Use the side effect variable in `slice_pop_back` (noir-lang/noir#10455)
fix: correct location for out of bounds match case integer (noir-lang/noir#10454)
fix: Defunctionalize foreign functions in pre-SSA pass over mAST (noir-lang/noir#10160)
fix: use unit for fmtstr without variables (noir-lang/noir#10456)
chore(docs): Update tinyjs app tutorial for versioned docs (noir-lang/noir#10453)
fix(frontend): Resolve to correct type on fmtstr interpolation error (noir-lang/noir#10450)
fix: avoid producing duplicate private error messages (noir-lang/noir#10449)
chore(docs): update dependencies and installation instructions in NoirJS tutorial and examples (noir-lang/noir#10400)
fix(compiler): Improve error message for impl on primitive types (noir-lang/noir#10430) (noir-lang/noir#10442)
chore: get trait as non-mut (noir-lang/noir#10447)
chore(frontend): Tuple dereference chain unit test and minor method reorg (noir-lang/noir#10410)
fix(doc): analyze sub-modules imports before self (noir-lang/noir#10390)
chore: green light for blackbox_solver audit (noir-lang/noir#10372)
chore: use `get_last_condition` in `link_condition` (noir-lang/noir#10424)
chore: bump external pinned commits (noir-lang/noir#10443)
feat: primitive types doc comments (noir-lang/noir#10432)
chore(frontend): Trait impl Self path unit tests (noir-lang/noir#10437)
END_COMMIT_OVERRIDE
github-merge-queue bot pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 11, 2025
Automated pull of nightly from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
fix(brillig_gen): Switch to iterative variable liveness
(noir-lang/noir#10460)
feat: remove unnecessary mutation of blackbox functions during
flattening (noir-lang/noir#10182)
chore: revert "fix: revert "feat(ACIR): reuse element_type_sizes blocks
with… (noir-lang/noir#10461)
chore: green light for acir (native_types) audit
(noir-lang/noir#10381)
chore: lock Cargo.lock in cargo-binstall
(noir-lang/noir#10459)
fix(acir-gen): Use the side effect variable in `slice_pop_back`
(noir-lang/noir#10455)
fix: correct location for out of bounds match case integer
(noir-lang/noir#10454)
fix: Defunctionalize foreign functions in pre-SSA pass over mAST
(noir-lang/noir#10160)
fix: use unit for fmtstr without variables
(noir-lang/noir#10456)
chore(docs): Update tinyjs app tutorial for versioned docs
(noir-lang/noir#10453)
fix(frontend): Resolve to correct type on fmtstr interpolation error
(noir-lang/noir#10450)
fix: avoid producing duplicate private error messages
(noir-lang/noir#10449)
chore(docs): update dependencies and installation instructions in NoirJS
tutorial and examples (noir-lang/noir#10400)
fix(compiler): Improve error message for impl on primitive types
(noir-lang/noir#10430)
(noir-lang/noir#10442)
chore: get trait as non-mut
(noir-lang/noir#10447)
chore(frontend): Tuple dereference chain unit test and minor method
reorg (noir-lang/noir#10410)
fix(doc): analyze sub-modules imports before self
(noir-lang/noir#10390)
chore: green light for blackbox_solver audit
(noir-lang/noir#10372)
chore: use `get_last_condition` in `link_condition`
(noir-lang/noir#10424)
chore: bump external pinned commits
(noir-lang/noir#10443)
feat: primitive types doc comments
(noir-lang/noir#10432)
chore(frontend): Trait impl Self path unit tests
(noir-lang/noir#10437)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants