Skip to content

Commit d7732e4

Browse files
committed
don't optimize debuginfo for artifact dependencies
1 parent 6c43053 commit d7732e4

File tree

1 file changed

+7
-2
lines changed
  • src/cargo/ops/cargo_compile

1 file changed

+7
-2
lines changed

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,13 @@ fn traverse_and_share(
635635
let mut profile = unit.profile.clone();
636636

637637
// If this is a build dependency, and it's not shared with runtime dependencies, we can weaken
638-
// its debuginfo level to optimize build times.
639-
if unit.kind.is_host() && to_host.is_some() && profile.debuginfo.is_deferred() {
638+
// its debuginfo level to optimize build times. We do nothing if it's an artifact dependency,
639+
// as it and its debuginfo may end up embedded in the main program.
640+
if unit.kind.is_host()
641+
&& to_host.is_some()
642+
&& profile.debuginfo.is_deferred()
643+
&& !unit.artifact.is_true()
644+
{
640645
// We create a "probe" test to see if a unit with the same explicit debuginfo level exists
641646
// in the graph. This is the level we'd expect if it was set manually or the default value
642647
// set by a profile for a runtime dependency: its canonical value.

0 commit comments

Comments
 (0)