Skip to content

feat: debug_ensure{,_eq,_ne} macros combining debug_assert* and anyhow::ensure (#6907) #6922

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iequidoo
Copy link
Collaborator

@iequidoo iequidoo commented Jun 16, 2025

See commit messages.
Still sometimes we don't want to error out in the release conf if the error isn't critical (in which case it's better to log a warning as @Hocuri suggested in #6907). Need to recheck all assertions and create a follow-up PR.

@iequidoo iequidoo force-pushed the iequidoo/debug_ensure branch from 1deedb1 to 6362989 Compare June 16, 2025 23:06
@iequidoo iequidoo requested review from Hocuri and link2xt June 16, 2025 23:16
@iequidoo iequidoo force-pushed the iequidoo/debug_ensure branch from 6362989 to 3b165d1 Compare June 16, 2025 23:57
Base automatically changed from link2xt/pgp-contacts to main June 26, 2025 14:06
@link2xt link2xt force-pushed the main branch 2 times, most recently from 285d80a to 416131b Compare June 26, 2025 14:07
@iequidoo iequidoo force-pushed the iequidoo/debug_ensure branch from 3b165d1 to a6f850e Compare June 26, 2025 22:21
…w::ensure (#6907)

We have some debug assertions already, but we also want the corresponding errors in the release
configuration so that it's not less reliable than non-optimized one. This doesn't change any
function signatures, only debug assertions in functions returning `Result` are replaced.
@iequidoo iequidoo force-pushed the iequidoo/debug_ensure branch from a6f850e to 3dec58b Compare July 1, 2025 14:53
@link2xt
Copy link
Collaborator

link2xt commented Jul 6, 2025

I don't like the naming, for me debug_* macros mean that it is only doing something in debug mode. Don't know how to name it better, maybe something like ensure_and_debug_assert!.

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