Skip to content

$CARGO_CFG_DEBUG_ASSERTIONS is set to the empty string in build scripts for both debug and release modes #6148

@ecstatic-morse

Description

@ecstatic-morse

The following build script will print "" when run with both cargo build and cargo build --release.

use std::env;

fn main() {
    if let Ok(s) = env::var("CARGO_CFG_DEBUG_ASSERTIONS") {
        panic!("\"{}\"", s);
    } else {
        panic!("CARGO_CFG_DEBUG_ASSERTIONS not set");
    }
}

I would expect the CARGO_CFG_DEBUG_ASSERTIONS environment variable to be unset in release mode (where cfg!(debug_assertions) is false by default).

Version info:
cargo 1.30.0-nightly (b917e3524 2018-09-09)

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

    Issue actions