Skip to content

feat: ensure_and_debug_assert{,_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

Merged
merged 4 commits into from
Jul 11, 2025

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 2 times, most recently 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!.

…* and anyhow::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 3dec58b to b84c392 Compare July 10, 2025 22:05
iequidoo and others added 3 commits July 11, 2025 14:57
Co-authored-by: l <link2xt@testrun.org>
Co-authored-by: l <link2xt@testrun.org>
Co-authored-by: l <link2xt@testrun.org>
@iequidoo iequidoo merged commit 0359481 into main Jul 11, 2025
18 checks passed
@iequidoo iequidoo deleted the iequidoo/debug_ensure branch July 11, 2025 17:59
@iequidoo iequidoo changed the title feat: debug_ensure{,_eq,_ne} macros combining debug_assert* and anyhow::ensure (#6907) feat: ensure_and_debug_assert{,_eq,_ne} macros combining debug_assert* and anyhow::ensure (#6907) Jul 11, 2025
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