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: debug_assert to assert #924

Merged
merged 1 commit into from
Feb 28, 2023
Merged

Conversation

supernovahs
Copy link
Contributor

Changing debug_assert to assert

Resolves #781

@supernovahs supernovahs changed the title debug_assert to assert chore : debug_assert to assert Feb 27, 2023
@supernovahs supernovahs changed the title chore : debug_assert to assert chore:debug_assert to assert Feb 27, 2023
@supernovahs supernovahs changed the title chore:debug_assert to assert chore: debug_assert to assert Feb 27, 2023
Copy link
Contributor

@guipublic guipublic left a comment

Choose a reason for hiding this comment

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

I disagree with the issue #781, and hence with this PR.
"Debug_assert are optimised in release build": this is exactly their feature, and so the reason why we use debug_assert instead of assert. Changing them to assert because of this, is simply pure non sense.

@kevaundray
Copy link
Contributor

Hi @guipublic thank you for sharing your opinion on this matter.

Reading the documentation on debug_assert here

It states that:

An unchecked assertion allows a program in an inconsistent state to keep running, which might have unexpected consequences but does not introduce unsafety as long as this only happens in safe code. The performance cost of assertions, however, is not measurable in general. Replacing assert! with debug_assert! is thus only encouraged after thorough profiling, and more importantly, only in safe code!

As such, I think its okay to use assertions everywhere and we can re-evaluate if there are any significant performance impacts. What we care about is safe code and if there are invariants that need to be upheld, we should not by default omit those regardless of the build

@kevaundray kevaundray dismissed guipublic’s stale review February 28, 2023 17:42

Documentation recommends this -- if there are any issues, lets continue on the issue

@kevaundray kevaundray enabled auto-merge February 28, 2023 17:42
auto-merge was automatically disabled February 28, 2023 17:43

Merge queue setting changed

@kevaundray kevaundray enabled auto-merge February 28, 2023 17:59
@kevaundray kevaundray added this pull request to the merge queue Feb 28, 2023
Merged via the queue into noir-lang:master with commit 96328e4 Feb 28, 2023
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.

Remove debug_asserts for internal compiler errors
3 participants