diff --git a/src/cargo/core/profiles.rs b/src/cargo/core/profiles.rs index a480143a04e..ddea1de7874 100644 --- a/src/cargo/core/profiles.rs +++ b/src/cargo/core/profiles.rs @@ -762,7 +762,7 @@ impl DebugInfo { } } - /// Returns true if the debuginfo level is high enough (at least 1). Helper + /// Returns true if any debuginfo will be generated. Helper /// for a common operation on the usual `Option` representation. pub(crate) fn is_turned_on(&self) -> bool { !matches!(self.to_option(), None | Some(TomlDebugInfo::None)) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 18aef026310..a28b8240ae7 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -477,8 +477,9 @@ impl<'de> de::Deserialize<'de> for TomlDebugInfo { type Value = TomlDebugInfo; fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { - formatter - .write_str("a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\"") + formatter.write_str( + "a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\"", + ) } fn visit_i64(self, value: i64) -> Result diff --git a/src/doc/src/reference/profiles.md b/src/doc/src/reference/profiles.md index 56c8538f80b..6b58d088883 100644 --- a/src/doc/src/reference/profiles.md +++ b/src/doc/src/reference/profiles.md @@ -67,9 +67,11 @@ amount of debug information included in the compiled binary. The valid options are: -* `0` or `false`: no debug info at all -* `1`: line tables only -* `2` or `true`: full debug info +* `0`, `false`, or `"none"`: no debug info at all +* `"line-directives-only"`: line info directives only. For the nvptx* targets this enables [profiling](https://reviews.llvm.org/D46061). For other use cases, `line-tables-only` is the better, more compatible choice. +* `"line-tables-only"`: line tables only. Generates the minimal amount of debug info for backtraces with filename/line number info, but not anything else, i.e. no variable or function parameter info. +* `1` or `"limited"`: debug info without type or variable-level information. Generates more detailed module-level info than `line-tables-only`. +* `2`, `true`, or `"full"`: full debug info You may wish to also configure the [`split-debuginfo`](#split-debuginfo) option depending on your needs as well. diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index aaf6accc532..2d3242837ff 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -1320,7 +1320,7 @@ fn bad_debuginfo() { error: failed to parse manifest [..] Caused by: - invalid value: string \"a\", expected a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\" + invalid value: string \"a\", expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\" in `profile.dev.debug` ", ) @@ -1352,7 +1352,7 @@ fn bad_debuginfo2() { error: failed to parse manifest at `[..]` Caused by: - invalid type: floating point `3.6`, expected a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\" + invalid type: floating point `3.6`, expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\" in `profile.dev.debug` ", )