Skip to content

Commit 719781b

Browse files
committed
Auto merge of #6971 - ehuss:finished-0-debug, r=alexcrichton
Set `Finished` line correctly for debug=0. Don't say `+ debuginfo` if `debug = 0`. Fixes #6948
2 parents 13e43aa + a03ae27 commit 719781b

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'a, 'cfg> JobQueue<'a, 'cfg> {
410410
} else {
411411
"optimized"
412412
});
413-
if profile.debuginfo.is_some() {
413+
if profile.debuginfo.unwrap_or(0) != 0 {
414414
opt_type += " + debuginfo";
415415
}
416416

tests/testsuite/profiles.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,3 +408,32 @@ fn panic_unwind_does_not_build_twice() {
408408
)
409409
.run();
410410
}
411+
412+
#[test]
413+
fn debug_0_report() {
414+
// The finished line handles 0 correctly.
415+
let p = project()
416+
.file(
417+
"Cargo.toml",
418+
r#"
419+
[package]
420+
name = "foo"
421+
version = "0.1.0"
422+
423+
[profile.dev]
424+
debug = 0
425+
"#,
426+
)
427+
.file("src/lib.rs", "")
428+
.build();
429+
430+
p.cargo("build -v")
431+
.with_stderr(
432+
"\
433+
[COMPILING] foo v0.1.0 [..]
434+
[RUNNING] `rustc --crate-name foo src/lib.rs [..]-C debuginfo=0 [..]
435+
[FINISHED] dev [unoptimized] target(s) in [..]
436+
",
437+
)
438+
.run();
439+
}

0 commit comments

Comments
 (0)