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

Could assert2 have a const_assert and a const_debug_assert? #25

Open
U007D opened this issue Oct 20, 2022 · 3 comments
Open

Could assert2 have a const_assert and a const_debug_assert? #25

U007D opened this issue Oct 20, 2022 · 3 comments

Comments

@U007D
Copy link

U007D commented Oct 20, 2022

Wondering if you'd be open to this as a part of assert2?

This would eliminate a dependency for me in many of my projects and presumably would for others too.

@de-vri-es
Copy link
Owner

de-vri-es commented Oct 20, 2022

Hey, it's certainly interesting, and providing a one-shop-stop for testing utilities is certainly something I would like for this crate.

The only problem I see is that we can't really do pretty assertions at compile time. I'm not aware of a way for proc macros to evaluate const expressions at compile time, so we cant do our own error formatting.

Another thing we should keep in mind is that assert2 comes with some dependencies that you probably don't want for normal builds. Currently, that is fine, because assert2 can be a dev-dependency. But you use it for const_assert it would have to be a regular dependency.

None of this is necessarily blocking (especially not the second one), it's just an explanation of why I haven't done it yet.

@U007D
Copy link
Author

U007D commented Nov 1, 2022

Good points re: pretty-printing.

Out of curiosity, why would a const_assert capability prevent assert2 from being usable as a dev dependency?

@de-vri-es
Copy link
Owner

assert2 could still be used as a dev-dependency, but const_assert itself could not, as it is always required during compilation.

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

No branches or pull requests

2 participants