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
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:
inherits = "dev"
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 (
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.
The confusing part that makes people call it
debug, to my thinking, is that the binaries end up in
target/debug/ instead of
For historical reasons, the
test profiles are stored in the
debug directory, and the
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.
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?