Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

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

Closed
ecstatic-morse opened this issue Oct 6, 2018 · 1 comment

Comments

@ecstatic-morse
Copy link
Contributor

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)

@ecstatic-morse ecstatic-morse changed the title $CARGO_CFG_DEBUG_ASSERTIONS is set to the empty string in both debug and release modes $CARGO_CFG_DEBUG_ASSERTIONS is set to the empty string in build scripts for both debug and release modes Oct 6, 2018
@alexcrichton
Copy link
Member

Thanks for the report! I believe this is a duplicate of #5777, so I'm going to close in favor of that.

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

No branches or pull requests

2 participants