diff --git a/src/cargo/core/compiler/job_queue.rs b/src/cargo/core/compiler/job_queue.rs index 693dc01b603..bdb5c2aff60 100644 --- a/src/cargo/core/compiler/job_queue.rs +++ b/src/cargo/core/compiler/job_queue.rs @@ -410,7 +410,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> { } else { "optimized" }); - if profile.debuginfo.is_some() { + if profile.debuginfo.unwrap_or(0) != 0 { opt_type += " + debuginfo"; } diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index f2214e58365..40454f93ead 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -408,3 +408,32 @@ fn panic_unwind_does_not_build_twice() { ) .run(); } + +#[test] +fn debug_0_report() { + // The finished line handles 0 correctly. + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [profile.dev] + debug = 0 + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build -v") + .with_stderr( + "\ +[COMPILING] foo v0.1.0 [..] +[RUNNING] `rustc --crate-name foo src/lib.rs [..]-C debuginfo=0 [..] +[FINISHED] dev [unoptimized] target(s) in [..] +", + ) + .run(); +}