Skip to content

Allow configuring -C debug-assertions setting #1398

Closed
@rprichard

Description

@rprichard

cargo currently passes -g when debugging is on and --cfg ndebug when debugging is off:

if profile.debug() {
    cmd.arg("-g");
} else {
    cmd.args(&["--cfg", "ndebug"]);
}

The rust compiler recently stopped using --cfg ndebug to control debug_assert! and instead uses #[cfg(debug_assertions)], enabled when the optimization-level is 0, and overridable using -C debug-assertions (RFC 563)

We may want to add a debug_assertions profile setting like the existing opt-level and debug settings. Even if we don't, though, we should at least stop passing --cfg ndebug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsE-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions