Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Run with debug-assertions and overflow-checks turned on #63

Open
pedantic79 opened this issue Dec 3, 2020 · 3 comments
Open

Run with debug-assertions and overflow-checks turned on #63

pedantic79 opened this issue Dec 3, 2020 · 3 comments

Comments

@pedantic79
Copy link

This is some-what similar to #18, where the debug symbols are turned on, but there are quite a few other differences between the dev and release profiles.

Certain classes of bugs are ignored in the release profile, and it makes finding them difficult. The easiest thing to do would be add the following to the profile if a flag is turned on.

debug-assertions = true
overflow-checks = true

The overflow checks are really useful to make sure you aren't overflowing on a multiplication step that is common at the end. The debug-assertion, makes sure that you aren't doing something dumb that would normally be caught.

The release profile disables them compared to the dev profile.

@pedantic79 pedantic79 changed the title Run with assertions turned enabled Run with assertions enabled Dec 6, 2020
@tocklime
Copy link

As a workaround, you can set the environment variable CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS = "true" to enable overflow checks. There might be something similar for debug assertions. You might be able to get it to work with a RUSTFLAGS setting too.

@pedantic79
Copy link
Author

According to https://doc.rust-lang.org/cargo/reference/environment-variables.html#configuration-environment-variables,

The debug-assertions should be configurable with CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS = "true"

@pedantic79 pedantic79 changed the title Run with assertions enabled Run with debug-assertions and overflow-checks turned on Dec 17, 2020
@bddap
Copy link

bddap commented Nov 28, 2021

I just ran into this. A --debug flag would be nice.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants