Skip to content

Project-wide profile.debug not taking preference over global setting? #16080

@d-e-s-o

Description

@d-e-s-o

Problem

To improve build performance, I am using

[profile.dev]
debug = "line-tables-only"

in the global ~/.cargo/config.toml configuration (see for example https://nnethercote.github.io/perf-book/build-configuration.html#disable-debug-info-generation).

I expect that a project-wide setting should supercede this setting, but that does not appear to be the case.

cargo new foobar
cd foobar
cat <<EOF >> Cargo.toml
[profile.dev]
debug = "full"
EOF

# With global configuration INACTIVE:
cargo build
llvm-dwarfdump target/debug/foobar | wc -l
> 1562

# With global configuration ACTIVE:
cargo clean # seems to be necessary because global profile setting change does not cause a rebuild?!
cargo build
llvm-dwarfdump /tmp/rust-targets/debug/foobar | wc -l
> 124

If the project-wide setting were to take preference, the result should be unchanged. If I change the global setting to none I see a line count of 3.

Steps

See above.

Possible Solution(s)

I believe the project profile settings should take preference over global configuration.

Notes

No response

Version

rustc --version --verbose
rustc 1.90.0-nightly (1159e78c4 2025-09-14) (gentoo)
binary: rustc
commit-hash: 1159e78c4747b02ef996e55082b704c09b970588
commit-date: 2025-09-14
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.8

cargo --version
cargo 1.90.0-nightly (840b83a10 2025-07-30) (gentoo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-config-profileArea: `[profile]` in cargo config filesA-configurationArea: cargo config files and env varsA-profilesArea: profilesC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions