Skip to content

Document that -C opt-level=0 implies -C debug-assertions more prominently #39449

Closed
@mystor

Description

@mystor
Contributor

All I was able to find documenting this is an ambiguous mention in the rust reference:
https://github.com/rust-lang/rust/blob/17cae033787aca26b00a8c820c1599926a1fd94d/src/doc/reference.md#conditional-compilation

It would be nice if, for example, the documentation for std::debug_assert! was updated to mention:

Unlike assert!, debug_assert! statements are only enabled in non optimized builds by default. An optimized build will omit all debug_assert! statements unless -C debug-assertions or -C opt-level=0 is passed to the compiler. This makes debug_assert! useful for checks that are too expensive to be present in a release build but may be helpful during development.

Activity

nagisa

nagisa commented on Feb 1, 2017

@nagisa
Member

“An optimized build” seems to very clearly imply that opt-level ≠ 0 to me.

mystor

mystor commented on Feb 1, 2017

@mystor
ContributorAuthor

That's true - I missed that on the first reading.

daxpedda

daxpedda commented on Dec 21, 2018

@daxpedda
Contributor

Was currently trying to work with the cargo api and was struggling to find the issue until I found out about this.

In the new documentation this is mentioned nowhere:
https://doc.rust-lang.org/nightly/rustc/codegen-options/index.html#opt-level

added a commit that references this issue on Jan 18, 2019

Rollup merge of rust-lang#57132 - daxpedda:master, r=steveklabnik

04a2cbd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nagisa@mystor@daxpedda

        Issue actions

          Document that `-C opt-level=0` implies `-C debug-assertions` more prominently · Issue #39449 · rust-lang/rust