Discrepancy between profile name dev and convention of calling it debug

Hi y'all

I've been recently thinking about the difference of naming of the release profile dev and the convention to call it debug. I was wondering if changing/aliasing dev to debug could be sensible. Maybe it's too small of a thing to change compared to the increase in technical debt of having two ways to specify the same thing or deprecating the old name. Especially as you don't often have to spell it out since it is the default in cargo. But it tripped me up a few times. Once I even thought that there is a flag in cargo called --debug but on looking it up that doesn't even exist.

I think this would conflict with the release process: https://forge.rust-lang.org/release/process.html.

You can easily do that for your own crates:

[profile.debug]
inherits = "dev"

At the cargo level, I don't expect stuff like this to ever be implemented. Having two identical, but not guaranteed identical, profiles would be mostly confusing.

I also think that the dev name is much better than debug one. It corresponds to the actual usage of that profile: it's a profile optimized for developers' experience. Which means more checks (debug-assertions & overflow-checks), less optimizations, runtime performance traded for faster compilation, more debug information etc. debug, on the other hand, is confusing, because extra debugging checks & debug info can be added (or removed) to any profile, and debug logging isn't even controlled at the profile level. Instead it is typically determined by the runtime RUST_LOG environment variable.

That said, I also usually call the dev profile "debug". It's a habit from the C/C++ world, where that's the way those configurations are usually called, and where debug configuration is often coupled to the debugging checks at the source code level. Still, I consider it a bad habit, and prefer the tools & docs to use more precise and intuitive terminology.

1 Like

The confusing part that makes people call it debug, to my thinking, is that the binaries end up in target/debug/ instead of target/dev/.

For historical reasons, the dev and test profiles are stored in the debug directory, and the release and bench profiles are stored in the release directory. User-defined profiles are stored in a directory with the same name as the profile.

Build Cache - The Cargo Book

If something were to be done, then in my opinion it should be eliminating this special case so that target/ is laid out uniformly.

10 Likes

Thanks for those contributions. I agree that dev is more descriptive. And I also would like to see dev and test get their own folders that are named accordingly. Unless of course that leads to longer compile times. Do you know if anything is shared between the two?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.