Skip to content

Commit 8a9db7a

Browse files
committed
Address review comments
- Update the documentation and doc-comments - Improve the error message for parsing Cargo.toml
1 parent 3dbb474 commit 8a9db7a

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/cargo/core/profiles.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ impl DebugInfo {
762762
}
763763
}
764764

765-
/// Returns true if the debuginfo level is high enough (at least 1). Helper
765+
/// Returns true if any debuginfo will be generated. Helper
766766
/// for a common operation on the usual `Option` representation.
767767
pub(crate) fn is_turned_on(&self) -> bool {
768768
!matches!(self.to_option(), None | Some(TomlDebugInfo::None))

src/cargo/util/toml/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,9 @@ impl<'de> de::Deserialize<'de> for TomlDebugInfo {
477477
type Value = TomlDebugInfo;
478478

479479
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
480-
formatter
481-
.write_str("a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\"")
480+
formatter.write_str(
481+
"a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\"",
482+
)
482483
}
483484

484485
fn visit_i64<E>(self, value: i64) -> Result<TomlDebugInfo, E>

src/doc/src/reference/profiles.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ amount of debug information included in the compiled binary.
6767

6868
The valid options are:
6969

70-
* `0` or `false`: no debug info at all
71-
* `1`: line tables only
72-
* `2` or `true`: full debug info
70+
* `0`, `false`, or `"none"`: no debug info at all
71+
* `"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.
72+
* `"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.
73+
* `1` or `"limited"`: debug info without type or variable-level information. Generates more detailed module-level info than `line-tables-only`.
74+
* `2`, `true`, or `"full"`: full debug info
7375

7476
You may wish to also configure the [`split-debuginfo`](#split-debuginfo) option
7577
depending on your needs as well.

tests/testsuite/bad_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ fn bad_debuginfo() {
13201320
error: failed to parse manifest [..]
13211321
13221322
Caused by:
1323-
invalid value: string \"a\", expected a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\"
1323+
invalid value: string \"a\", expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\"
13241324
in `profile.dev.debug`
13251325
",
13261326
)
@@ -1352,7 +1352,7 @@ fn bad_debuginfo2() {
13521352
error: failed to parse manifest at `[..]`
13531353
13541354
Caused by:
1355-
invalid type: floating point `3.6`, expected a boolean, 0-2, \"line-tables-only\", or \"line-directives-only\"
1355+
invalid type: floating point `3.6`, expected a boolean, 0, 1, 2, \"line-tables-only\", or \"line-directives-only\"
13561356
in `profile.dev.debug`
13571357
",
13581358
)

0 commit comments

Comments
 (0)