diff --git a/crates/cargo-util-schemas/src/restricted_names.rs b/crates/cargo-util-schemas/src/restricted_names.rs
index 44c17a9968c..dfe44bfb92b 100644
--- a/crates/cargo-util-schemas/src/restricted_names.rs
+++ b/crates/cargo-util-schemas/src/restricted_names.rs
@@ -137,14 +137,6 @@ pub(crate) fn validate_profile_name(name: &str) -> Result<()> {
}
let lower_name = name.to_lowercase();
- if lower_name == "debug" {
- return Err(ErrorKind::ProfileNameReservedKeyword {
- name: name.into(),
- help: "To configure the default development profile, \
- use the name `dev` as in [profile.dev]",
- }
- .into());
- }
if lower_name == "build-override" {
return Err(ErrorKind::ProfileNameReservedKeyword {
name: name.into(),
diff --git a/doc/book/src/commands/cargo-bench.md b/doc/book/src/commands/cargo-bench.md
index 3e871f27105..74fe4ee7864 100644
--- a/doc/book/src/commands/cargo-bench.md
+++ b/doc/book/src/commands/cargo-bench.md
@@ -46,8 +46,8 @@ function to handle running benchmarks.
By default, `cargo bench` uses the [`bench` profile], which enables
optimizations and disables debugging information. If you need to debug a
-benchmark, you can use the `--profile=dev` command-line option to switch to
-the dev profile. You can then run the debug-enabled benchmark within a
+benchmark, you can use the `--profile=debug` command-line option to switch to
+the debug profile. You can then run the debug-enabled benchmark within a
debugger.
[`bench` profile]: ../reference/profiles.html#bench
diff --git a/doc/book/src/commands/cargo-install.md b/doc/book/src/commands/cargo-install.md
index dd17bde89c1..ff962e6d6f8 100644
--- a/doc/book/src/commands/cargo-install.md
+++ b/doc/book/src/commands/cargo-install.md
@@ -260,7 +260,7 @@ is specified.
Build with the dev profile instead of the release profile.
+
Build with the debug profile instead of the release profile.
See also the --profile option for choosing a specific profile by name.
diff --git a/doc/book/src/commands/cargo-test.md b/doc/book/src/commands/cargo-test.md
index 71183f9b7bc..b21f4e60b50 100644
--- a/doc/book/src/commands/cargo-test.md
+++ b/doc/book/src/commands/cargo-test.md
@@ -38,7 +38,10 @@ manifest settings, in which case your code will need to provide its own `main`
function to handle running tests.
By default, `cargo test` uses the [`test` profile], which enables
-debugging.
+some optimizations and disables debugging information for fast feedback. If you need to debug a
+test, you can use the `--profile=debug` command-line option to switch to
+the debug profile. You can then run the debug-enabled test within a
+debugger.
[`test` profile]: ../reference/profiles.html#test
diff --git a/doc/book/src/reference/profiles.md b/doc/book/src/reference/profiles.md
index 5ad011e2af2..894a8bf77f7 100644
--- a/doc/book/src/reference/profiles.md
+++ b/doc/book/src/reference/profiles.md
@@ -262,8 +262,8 @@ whether or not [`rpath`] is enabled.
### dev
-The `dev` profile is used for normal development and debugging. It is the
-default for build commands like [`cargo build`], and is used for `cargo install --debug`.
+The `dev` profile is used for normal development. It is the
+default for build commands like [`cargo build`], and is used for `cargo install --profile dev`.
The default settings for the `dev` profile are:
@@ -282,6 +282,17 @@ codegen-units = 256
rpath = false
```
+### debug
+
+The `debug` profile is used for creating binaries to run with a debugger. It is used with `cargo build --profile debug` and `cargo install --debug`.
+
+The default settings for the `debug` profile are:
+
+```toml
+[profile.debug]
+inherits = "dev"
+```
+
### release
The `release` profile is intended for optimized artifacts used for releases
diff --git a/doc/man/cargo-bench.md b/doc/man/cargo-bench.md
index a1f5028e3ba..6a38854b8a9 100644
--- a/doc/man/cargo-bench.md
+++ b/doc/man/cargo-bench.md
@@ -51,8 +51,8 @@ function to handle running benchmarks.
By default, `cargo bench` uses the [`bench` profile], which enables
optimizations and disables debugging information. If you need to debug a
-benchmark, you can use the `--profile=dev` command-line option to switch to
-the dev profile. You can then run the debug-enabled benchmark within a
+benchmark, you can use the `--profile=debug` command-line option to switch to
+the debug profile. You can then run the debug-enabled benchmark within a
debugger.
[`bench` profile]: ../reference/profiles.html#bench
diff --git a/doc/man/cargo-install.md b/doc/man/cargo-install.md
index 1b1d823f0e9..ac816afc2f0 100644
--- a/doc/man/cargo-install.md
+++ b/doc/man/cargo-install.md
@@ -178,7 +178,7 @@ Directory to install packages into.
{{> options-target-dir }}
{{#option "`--debug`" }}
-Build with the `dev` profile instead of the `release` profile.
+Build with the `debug` profile instead of the `release` profile.
See also the `--profile` option for choosing a specific profile by name.
{{/option}}
diff --git a/doc/man/cargo-test.md b/doc/man/cargo-test.md
index c9105f9fc61..181a8e78044 100644
--- a/doc/man/cargo-test.md
+++ b/doc/man/cargo-test.md
@@ -43,7 +43,10 @@ manifest settings, in which case your code will need to provide its own `main`
function to handle running tests.
By default, `cargo test` uses the [`test` profile], which enables
-debugging.
+some optimizations and disables debugging information for fast feedback. If you need to debug a
+test, you can use the `--profile=debug` command-line option to switch to
+the debug profile. You can then run the debug-enabled test within a
+debugger.
[`test` profile]: ../reference/profiles.html#test
diff --git a/doc/man/generated_txt/cargo-bench.txt b/doc/man/generated_txt/cargo-bench.txt
index 089ed26453a..8f8c1ea79b1 100644
--- a/doc/man/generated_txt/cargo-bench.txt
+++ b/doc/man/generated_txt/cargo-bench.txt
@@ -46,9 +46,9 @@ DESCRIPTION
By default, cargo bench uses the bench profile
, which
enables optimizations and disables debugging information. If you need to
- debug a benchmark, you can use the --profile=dev command-line option to
- switch to the dev profile. You can then run the debug-enabled benchmark
- within a debugger.
+ debug a benchmark, you can use the --profile=debug command-line option
+ to switch to the debug profile. You can then run the debug-enabled
+ benchmark within a debugger.
Working directory of benchmarks
The working directory of every benchmark is set to the root directory of
diff --git a/doc/man/generated_txt/cargo-install.txt b/doc/man/generated_txt/cargo-install.txt
index fc695558215..96373360f4e 100644
--- a/doc/man/generated_txt/cargo-install.txt
+++ b/doc/man/generated_txt/cargo-install.txt
@@ -226,8 +226,8 @@ OPTIONS
workspace of the local crate unless --target-dir is specified.
--debug
- Build with the dev profile instead of the release profile. See also
- the --profile option for choosing a specific profile by name.
+ Build with the debug profile instead of the release profile. See
+ also the --profile option for choosing a specific profile by name.
--profile name
Install with the given profile. See the reference
diff --git a/doc/man/generated_txt/cargo-test.txt b/doc/man/generated_txt/cargo-test.txt
index bd27f8ff796..d48ac64d8cf 100644
--- a/doc/man/generated_txt/cargo-test.txt
+++ b/doc/man/generated_txt/cargo-test.txt
@@ -38,7 +38,10 @@ DESCRIPTION
By default, cargo test uses the test profile
, which
- enables debugging.
+ enables some optimizations and disables debugging information for fast
+ feedback. If you need to debug a test, you can use the --profile=debug
+ command-line option to switch to the debug profile. You can then run the
+ debug-enabled test within a debugger.
Documentation tests
Documentation tests are also run by default, which is handled by
diff --git a/etc/man/cargo-bench.1 b/etc/man/cargo-bench.1
index 998c747ceca..a4aed656281 100644
--- a/etc/man/cargo-bench.1
+++ b/etc/man/cargo-bench.1
@@ -54,8 +54,8 @@ running benchmarks on the stable channel, such as
.sp
By default, \fBcargo bench\fR uses the \fI\f(BIbench\fI profile\fR , which enables
optimizations and disables debugging information. If you need to debug a
-benchmark, you can use the \fB\-\-profile=dev\fR command\-line option to switch to
-the dev profile. You can then run the debug\-enabled benchmark within a
+benchmark, you can use the \fB\-\-profile=debug\fR command\-line option to switch to
+the debug profile. You can then run the debug\-enabled benchmark within a
debugger.
.SS "Working directory of benchmarks"
The working directory of every benchmark is set to the root directory of the
diff --git a/etc/man/cargo-install.1 b/etc/man/cargo-install.1
index a16c7eb16aa..94d64bbfa42 100644
--- a/etc/man/cargo-install.1
+++ b/etc/man/cargo-install.1
@@ -281,7 +281,7 @@ is specified.
.sp
\fB\-\-debug\fR
.RS 4
-Build with the \fBdev\fR profile instead of the \fBrelease\fR profile.
+Build with the \fBdebug\fR profile instead of the \fBrelease\fR profile.
See also the \fB\-\-profile\fR option for choosing a specific profile by name.
.RE
.sp
diff --git a/etc/man/cargo-test.1 b/etc/man/cargo-test.1
index 2a63f51b8c7..2643cb85670 100644
--- a/etc/man/cargo-test.1
+++ b/etc/man/cargo-test.1
@@ -41,7 +41,10 @@ manifest settings, in which case your code will need to provide its own \fBmain\
function to handle running tests.
.sp
By default, \fBcargo test\fR uses the \fI\f(BItest\fI profile\fR , which enables
-debugging.
+some optimizations and disables debugging information for fast feedback. If you need to debug a
+test, you can use the \fB\-\-profile=debug\fR command\-line option to switch to
+the debug profile. You can then run the debug\-enabled test within a
+debugger.
.SS "Documentation tests"
Documentation tests are also run by default, which is handled by \fBrustdoc\fR\&. It
extracts code samples from documentation comments of the library target, and
diff --git a/src/bin/cargo/commands/install.rs b/src/bin/cargo/commands/install.rs
index 92c7b1c2b5d..bd81f5799e0 100644
--- a/src/bin/cargo/commands/install.rs
+++ b/src/bin/cargo/commands/install.rs
@@ -92,12 +92,9 @@ pub fn cli() -> Command {
.arg_features()
.arg_parallel()
.arg(
- flag(
- "debug",
- "Build in debug mode (with the 'dev' profile) instead of release mode",
- )
- .conflicts_with("profile")
- .help_heading(heading::COMPILATION_OPTIONS),
+ flag("debug", "Build in debug mode instead of release mode")
+ .conflicts_with("profile")
+ .help_heading(heading::COMPILATION_OPTIONS),
)
.arg_redundant_default_mode("release", "install", "debug")
.arg_profile("Install artifacts with the specified profile")
diff --git a/src/util/command_prelude.rs b/src/util/command_prelude.rs
index f3ba638bc22..e09db6eb397 100644
--- a/src/util/command_prelude.rs
+++ b/src/util/command_prelude.rs
@@ -709,7 +709,7 @@ Run `{cmd}` to see possible targets."
) {
(false, false, None) => default,
(true, _, None) => "release",
- (_, true, None) => "dev",
+ (_, true, None) => "debug",
// `doc` is separate from all the other reservations because
// [profile.doc] was historically allowed, but is deprecated and
// has no effect. To avoid potentially breaking projects, it is a
diff --git a/src/workspace/parser/mod.rs b/src/workspace/parser/mod.rs
index 6e57423d0b6..16e88f29edf 100644
--- a/src/workspace/parser/mod.rs
+++ b/src/workspace/parser/mod.rs
@@ -2564,15 +2564,6 @@ pub fn validate_profile(
);
}
- // `inherits` validation
- if matches!(root.inherits.as_deref(), Some("debug")) {
- bail!(
- "profile.{}.inherits=\"debug\" should be profile.{}.inherits=\"dev\"",
- name,
- name
- );
- }
-
match name {
"doc" => {
warnings.push("profile `doc` is deprecated and has no effect".to_string());
diff --git a/src/workspace/profiles.rs b/src/workspace/profiles.rs
index 1f2509a8911..643e8b6401d 100644
--- a/src/workspace/profiles.rs
+++ b/src/workspace/profiles.rs
@@ -156,6 +156,13 @@ impl Profiles {
/// "root" profiles).
fn predefined_profiles() -> Vec<(&'static str, TomlProfile)> {
vec![
+ (
+ "debug",
+ TomlProfile {
+ inherits: Some(String::from("dev")),
+ ..TomlProfile::default()
+ },
+ ),
(
"bench",
TomlProfile {
@@ -1298,7 +1305,7 @@ fn merge_config_profiles(
}
// Add the built-in profiles. This is important for things like `cargo
// test` which implicitly use the "dev" profile for dependencies.
- for name in ["dev", "release", "test", "bench"] {
+ for name in ["dev", "release", "debug", "test", "bench"] {
check_to_add.insert(name.into());
}
// Add config-only profiles.
diff --git a/tests/testsuite/cargo_install/help/stdout.term.svg b/tests/testsuite/cargo_install/help/stdout.term.svg
index caa01b0c2c7..0596d150173 100644
--- a/tests/testsuite/cargo_install/help/stdout.term.svg
+++ b/tests/testsuite/cargo_install/help/stdout.term.svg
@@ -1,4 +1,4 @@
-