Skip to content

DEBUG env var in build.rs is incorrect if profile debug=0 #5370

Closed
@ehuss

Description

@ehuss

The DEBUG environment variable set for a build script currently gets set to true if you have a profile with debug=0. AFAIK, rustc treats debug=0 the same as no debug, so I think it should be false.

Repro:

cargo new --lib a
cd a
cat >> Cargo.toml <<EOL
[profile.dev]
debug = 0
EOL
cat > build.rs <<EOL
fn main() { println!("DEBUG={}", std::env::var("DEBUG").unwrap()); }
EOL
cargo build -vv

I can fix this if you'd like.

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