From bd93d31b30e46c9fba71247f55a102aefd99a92d Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 23 Sep 2025 22:11:49 -0400 Subject: [PATCH] fix(config): make it clear which element in list is bad --- src/cargo/util/context/mod.rs | 2 +- tests/testsuite/cargo_alias_config.rs | 2 +- tests/testsuite/config.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cargo/util/context/mod.rs b/src/cargo/util/context/mod.rs index 4593807c1..006201898 100644 --- a/src/cargo/util/context/mod.rs +++ b/src/cargo/util/context/mod.rs @@ -2236,7 +2236,7 @@ impl ConfigValue { toml::Value::String(val) => Ok((val, def.clone())), v => { path.push(KeyOrIdx::Idx(i)); - bail!("expected string but found {} in list", v.type_str()) + bail!("expected string but found {} at index {i}", v.type_str()) } }) .collect::>()?, diff --git a/tests/testsuite/cargo_alias_config.rs b/tests/testsuite/cargo_alias_config.rs index cc2058dda..044a5a28a 100644 --- a/tests/testsuite/cargo_alias_config.rs +++ b/tests/testsuite/cargo_alias_config.rs @@ -90,7 +90,7 @@ Caused by: failed to parse config at `alias.b-cargo-test[0]` Caused by: - expected string but found integer in list + expected string but found integer at index 0 "#]]) .run(); diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 854094124..ff8bad643 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -1366,7 +1366,7 @@ Caused by: failed to parse config at `foo[0]` Caused by: - expected string but found integer in list + expected string but found integer at index 0 "#]], ); }