Uh oh!
There was an error while loading. Please reload this page.
Remove official ndebug variable support - #563
Conversation
huonw
commented
Jan 9, 2015
I'm in favour of movement along these lines; I find it weird to think that a |
SimonSapin
commented
Jan 9, 2015
It can be useful to run tests with both |
huonw
commented
Jan 9, 2015
@SimonSapin I think the suggestion is to allow |
SimonSapin
commented
Jan 9, 2015
Ok, that sounds fine. |
nikomatsakis
commented
Jan 9, 2015
Yes, this makes sense. |
nikomatsakis
commented
Jan 9, 2015
Thinking a bit more, I think it would be useful to have the ability to narrow down the list of modules for which debug-assertions are enabled, as well. I've wanted this in C++ from time to time (and achieved it, by playing with |
brson
commented
Jan 12, 2015
In favor of the general idea. |
brson
commented
Jan 12, 2015
For context |
sfackler
commented
Jan 12, 2015
The |
There was a problem hiding this comment.
Just clarifying, but by variable do you mean cfg directive? For example, I would be able to do:
ifcfg!(debug_assertions){/* super-expensive code */}brson
commented
Feb 2, 2015
I have a minor concern that What other things might |
huonw
commented
Feb 2, 2015
It seems like the flag could be more than just a boolean, but rather take a list of what to enable to allow fine-grained control, e.g. |
nikomatsakis
commented
Feb 2, 2015
Just re-read the RFC again. I like it. I definitely like this part of it:
The only question then is how fine-grained to make the "opting back in". That is, do we want to distinguish debug-assertions from integer-overflow etc? I think we certainly want a simple way to say "put back in all the optional debugging stuff". Having more control also seems good but I'd be happy for that to come later too. |
huonw
commented
Feb 17, 2015
Sorry for bikeshedding... if we want this to apply to more than just |
nikomatsakis
commented
Feb 18, 2015
@huonw I don't have a strong opinion. I'm going to merge the RFC in any case, I think, and we can bikeshed independently and update the RFC/impl as we go. I think the important part is that we plan on integrating this more deeply in the compiler and that we plan on having the defaults be connected to the optimization level. |
nikomatsakis
commented
Feb 18, 2015
The core team has decided to merge this RFC. There was no significant opposition, seems like a popular proposal all around. Some [minor] questions as to the precise command-line flags remain to be resolved [1, 2, 3], but the high-level idea of integrating ndebug more deeply into the compiler and tying it to the optimization flags is uncontroversial. |
nikomatsakis
commented
Feb 18, 2015
Tracking issue: rust-lang/rust#22492 |
add in unresolved questions from the RFC discussion.
This commit is an implementation of [RFC 563][rfc] which adds a new `cfg(debug_assertions)` directive which is specially recognized and calculated by the compiler. The flag is turned off at any optimization level greater than 1 and may also be explicitly controlled through the `-C debug-assertions` flag. [rfc]: rust-lang/rfcs#563 The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of the `ndebug` variable and `ndebug` no longer holds any meaning to the standard library. Code which was previously relying on `not(ndebug)` to gate expensive code should be updated to rely on `debug_assertions` instead. Closesrust-lang#22492 [breaking-change]
…kfelix This commit is an implementation of [RFC 563][rfc] which adds a new `cfg(debug_assertions)` directive which is specially recognized and calculated by the compiler. The flag is turned off at any optimization level greater than 1 and may also be explicitly controlled through the `-C debug-assertions` flag. [rfc]: rust-lang/rfcs#563 The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of the `ndebug` variable and `ndebug` no longer holds any meaning to the standard library. Code which was previously relying on `not(ndebug)` to gate expensive code should be updated to rely on `debug_assertions` instead. Closesrust-lang#22492 [breaking-change]
This commit is an implementation of [RFC 563][rfc] which adds a new `cfg(debug_assertions)` directive which is specially recognized and calculated by the compiler. The flag is turned off at any optimization level greater than 1 and may also be explicitly controlled through the `-C debug-assertions` flag. [rfc]: rust-lang/rfcs#563 The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of the `ndebug` variable and `ndebug` no longer holds any meaning to the standard library. Code which was previously relying on `not(ndebug)` to gate expensive code should be updated to rely on `debug_assertions` instead. Closesrust-lang#22492 [breaking-change]
…kfelix This commit is an implementation of [RFC 563][rfc] which adds a new `cfg(debug_assertions)` directive which is specially recognized and calculated by the compiler. The flag is turned off at any optimization level greater than 1 and may also be explicitly controlled through the `-C debug-assertions` flag. [rfc]: rust-lang/rfcs#563 The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of the `ndebug` variable and `ndebug` no longer holds any meaning to the standard library. Code which was previously relying on `not(ndebug)` to gate expensive code should be updated to rely on `debug_assertions` instead. Closesrust-lang#22492 [breaking-change]
Rendered View