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

nargo fmt crashes when a comment prefixed with "//" is followed by comment prefixed with "///" #7045

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

Comments

@benesjan
Copy link
Contributor

benesjan commented Jan 13, 2025

Bug

The following code:

pub fn array_length() -> u32 {
    // We get the length by checking the index of the first empty element.
    /// Safety: What?
    let value = unsafe { random() };
    value
}

makes the formatter crash with:

Image

but when I add there the slash:

pub fn array_length() -> u32 {
    /// We get the length by checking the index of the first empty element.
    /// Safety: What?
    let value = unsafe { random() };
    value
}

it compiles fine.

To Reproduce

Either copy the code above or check out janb/nargo-fmt-crash of aztec-packages, go to noir-projects/noir-protocol-circuits and run nargo fmt.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

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

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

@benesjan benesjan added the bug Something isn't working label Jan 13, 2025
@benesjan benesjan changed the title nargo fmt crash when double / comment is followed by triple one nargo fmt crash when a comment prefixed with "//" is followed by comment prefixed with "///" Jan 13, 2025
@benesjan benesjan changed the title nargo fmt crash when a comment prefixed with "//" is followed by comment prefixed with "///" nargo fmt crashes when a comment prefixed with "//" is followed by comment prefixed with "///" Jan 13, 2025
@asterite asterite self-assigned this Jan 13, 2025
nventuro pushed a commit to AztecProtocol/aztec-packages that referenced this issue Jan 15, 2025
Fixes #11087

## Note for reviewer
I originally addressed a bunch of other stuff in this PR but as
@nventuro pointed out it became too messy so I separated those changes
into a PR up the stack.

~**Merging currently blocked by** [this nargo fmt
bug](noir-lang/noir#7045

---------

Co-authored-by: Santiago Palladino <[email protected]>
AztecBot pushed a commit to AztecProtocol/aztec-nr that referenced this issue Jan 16, 2025
Fixes #11087

## Note for reviewer
I originally addressed a bunch of other stuff in this PR but as
@nventuro pointed out it became too messy so I separated those changes
into a PR up the stack.

~**Merging currently blocked by** [this nargo fmt
bug](noir-lang/noir#7045

---------

Co-authored-by: Santiago Palladino <[email protected]>
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