perf: Update toml

This commit is contained in:
Ed Page 2025-07-03 16:34:49 -05:00
parent 8f80388a78
commit 539a48452a
18 changed files with 129 additions and 80 deletions

87
Cargo.lock generated
View File

@ -295,7 +295,7 @@ dependencies = [
"cargo_metadata",
"flate2",
"tar",
"toml",
"toml 0.9.0",
]
[[package]]
@ -369,8 +369,8 @@ dependencies = [
"tempfile",
"thiserror 2.0.12",
"time",
"toml",
"toml_edit",
"toml 0.9.0",
"toml_edit 0.23.0",
"tracing",
"tracing-chrome",
"tracing-subscriber",
@ -472,7 +472,7 @@ dependencies = [
"snapbox",
"tar",
"time",
"toml",
"toml 0.9.0",
"url",
"walkdir",
"windows-sys 0.60.2",
@ -510,7 +510,7 @@ dependencies = [
"serde-untagged",
"serde-value",
"thiserror 1.0.69",
"toml",
"toml 0.8.23",
"unicode-xid",
"url",
]
@ -527,7 +527,7 @@ dependencies = [
"serde_json",
"snapbox",
"thiserror 2.0.12",
"toml",
"toml 0.9.0",
"unicode-xid",
"url",
]
@ -3659,6 +3659,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83"
dependencies = [
"serde",
]
[[package]]
name = "sha1"
version = "0.10.6"
@ -4039,9 +4048,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_edit 0.22.27",
]
[[package]]
name = "toml"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f271e09bde39ab52250160a67e88577e0559ad77e9085de6e9051a2c4353f8f8"
dependencies = [
"indexmap",
"serde",
"serde_spanned 1.0.0",
"toml_datetime 0.7.0",
"toml_parser",
"toml_writer",
"winnow",
]
[[package]]
@ -4053,6 +4077,15 @@ dependencies = [
"serde",
]
[[package]]
name = "toml_datetime"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3"
dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.22.27"
@ -4061,18 +4094,48 @@ checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"serde_spanned 0.6.9",
"toml_datetime 0.6.11",
"toml_write",
"winnow",
]
[[package]]
name = "toml_edit"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54449f7f7569ce6f57cda7812361961c0f6a77f720802537b5618585b4a7ff4c"
dependencies = [
"indexmap",
"serde",
"serde_spanned 1.0.0",
"toml_datetime 0.7.0",
"toml_parser",
"toml_writer",
"winnow",
]
[[package]]
name = "toml_parser"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5c1c469eda89749d2230d8156a5969a69ffe0d6d01200581cdc6110674d293e"
dependencies = [
"winnow",
]
[[package]]
name = "toml_write"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]]
name = "toml_writer"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b679217f2848de74cabd3e8fc5e6d66f40b7da40f8e1954d92054d9010690fd5"
[[package]]
name = "tracing"
version = "0.1.41"
@ -4752,7 +4815,7 @@ dependencies = [
name = "xtask-stale-label"
version = "0.0.0"
dependencies = [
"toml_edit",
"toml_edit 0.23.0",
]
[[package]]

View File

@ -105,8 +105,8 @@ tar = { version = "0.4.44", default-features = false }
tempfile = "3.20.0"
thiserror = "2.0.12"
time = { version = "0.3.41", features = ["parsing", "formatting", "serde"] }
toml = { version = "0.8.23", default-features = false }
toml_edit = { version = "0.22.27", features = ["serde"] }
toml = { version = "0.9.0", default-features = false }
toml_edit = { version = "0.23.0", features = ["serde"] }
tracing = { version = "0.1.41", default-features = false, features = ["std"] } # be compatible with rustc_log: https://github.com/rust-lang/rust/blob/e51e98dde6a/compiler/rustc_log/Cargo.toml#L9
tracing-chrome = "0.7.2"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
@ -211,7 +211,7 @@ tar.workspace = true
tempfile.workspace = true
thiserror.workspace = true
time.workspace = true
toml = { workspace = true, features = ["display", "parse"] }
toml = { workspace = true, features = ["std", "serde", "parse", "display"] }
toml_edit.workspace = true
tracing = { workspace = true, features = ["attributes"] }
tracing-subscriber.workspace = true

View File

@ -10,7 +10,7 @@ publish = false
cargo_metadata.workspace = true
flate2.workspace = true
tar.workspace = true
toml = { workspace = true, features = ["display", "parse"] }
toml = { workspace = true, features = ["display", "parse", "serde"] }
[lints]
workspace = true

View File

@ -27,7 +27,7 @@ serde_json.workspace = true
snapbox.workspace = true
tar.workspace = true
time.workspace = true
toml = { workspace = true, features = ["display"] }
toml = { workspace = true, features = ["display", "serde"] }
url.workspace = true
walkdir.workspace = true

View File

@ -16,7 +16,7 @@ serde_json = { workspace = true, optional = true }
serde-untagged.workspace = true
serde-value.workspace = true
thiserror.workspace = true
toml.workspace = true
toml = { workspace = true, features = ["serde"] }
unicode-xid.workspace = true
url.workspace = true

View File

@ -1043,10 +1043,9 @@ impl GlobalContext {
let def = Definition::Environment(key.as_env_key().to_string());
if self.cli_unstable().advanced_env && env_val.starts_with('[') && env_val.ends_with(']') {
// Parse an environment string as a TOML array.
let toml_v = toml::Value::deserialize(toml::de::ValueDeserializer::new(&env_val))
.map_err(|e| {
ConfigError::new(format!("could not parse TOML list: {}", e), def.clone())
})?;
let toml_v = env_val.parse::<toml::Value>().map_err(|e| {
ConfigError::new(format!("could not parse TOML list: {}", e), def.clone())
})?;
let values = toml_v.as_array().expect("env var was not array");
for value in values {
// TODO: support other types.

View File

@ -751,13 +751,11 @@ fn bad_registry_name() {
[ERROR] invalid character ` ` in registry name: `bad name`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
--> Cargo.toml:8:17
|
8 | / [dependencies.bar]
9 | | version = "0.0.1"
10 | | registry = "bad name"
| |_____________________________________^
|
--> Cargo.toml:8:17
|
8 | [dependencies.bar]
| ^^^^^^^^^^^^^^^^^^
|
"#]])
.run();

View File

@ -172,7 +172,7 @@ Caused by:
|
1 | 4
| ^
expected `.`, `=`
key with no value, expected `=`
"#]])
.run();
@ -454,8 +454,7 @@ fn malformed_override() {
p.cargo("check")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] invalid inline table
expected `}`
[ERROR] newlines are unsupported in inline tables, expected nothing
--> Cargo.toml:9:27
|
9 | native = {
@ -2130,8 +2129,7 @@ Caused by:
|
1 | [bar] baz = 2
| ^
invalid table header
expected newline, `#`
unexpected key or value, expected newline, `#`
"#]])
.run();

View File

@ -377,11 +377,11 @@ Caused by:
could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml`
Caused by:
TOML parse error at line 1, column 1
TOML parse error at line 1, column 2
|
1 | !
| ^
invalid key
| ^
key with no value, expected `=`
"#]])
.run();
@ -418,12 +418,11 @@ fn cargo_compile_with_invalid_manifest2() {
p.cargo("build")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] invalid string
expected `"`, `'`
[ERROR] string values must be quoted, expected literal string
--> Cargo.toml:3:23
|
3 | foo = bar
| ^
| ^^^
|
"#]])
@ -437,12 +436,11 @@ fn cargo_compile_with_invalid_manifest3() {
p.cargo("build --manifest-path src/Cargo.toml")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] invalid string
expected `"`, `'`
[ERROR] string values must be quoted, expected literal string
--> src/Cargo.toml:1:5
|
1 | a = bar
| ^
| ^^^
|
"#]])
@ -2740,7 +2738,7 @@ Caused by:
|
1 | this is not valid toml
| ^
expected `.`, `=`
key with no value, expected `=`
"#]])
.run();

View File

@ -1,4 +1,4 @@
<svg width="740px" height="164px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="146px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
@ -19,21 +19,19 @@
<rect width="100%" height="100%" y="0" rx="4.5" class="bg" />
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-bright-red bold">error</tspan><tspan>: </tspan><tspan class="bold">invalid string</tspan>
<tspan x="10px" y="28px"><tspan class="fg-bright-red bold">error</tspan><tspan>: </tspan><tspan class="bold">invalid float, expected `inf`</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan class="bold">expected `"`, `'`</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-bright-blue bold">--&gt;</tspan><tspan> Cargo.toml:9:7</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-bright-blue bold">--&gt;</tspan><tspan> Cargo.toml:9:7</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
</tspan>
<tspan x="10px" y="82px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
<tspan x="10px" y="82px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> key = invalid-value</tspan>
</tspan>
<tspan x="10px" y="100px"><tspan class="fg-bright-blue bold">9 |</tspan><tspan> key = invalid-value</tspan>
<tspan x="10px" y="100px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">^^^^^^^^^^^^^</tspan>
</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan><tspan> </tspan><tspan class="fg-bright-red bold">^</tspan>
<tspan x="10px" y="118px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
</tspan>
<tspan x="10px" y="136px"><tspan> </tspan><tspan class="fg-bright-blue bold">|</tspan>
</tspan>
<tspan x="10px" y="154px">
<tspan x="10px" y="136px">
</tspan>
</text>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -58,8 +58,7 @@ Caused by:
|
3 | b-cargo-test = `
| ^
invalid string
expected `"`, `'`
string values must be quoted, expected literal string
"#]])
.run();

View File

@ -859,7 +859,7 @@ Caused by:
|
1 | asdf
| ^
expected `.`, `=`
key with no value, expected `=`
"#]],
);
@ -931,9 +931,8 @@ expected a list, but found a integer for `l3` in [ROOT]/.cargo/config.toml
error in environment variable `CARGO_BAD_ENV`: could not parse TOML list: TOML parse error at line 1, column 2
|
1 | [zzz]
| ^
invalid array
expected `]`
| ^^^
string values must be quoted, expected literal string
"#]],
);
@ -1221,8 +1220,8 @@ Caused by:
TOML parse error at line 3, column 1
|
3 | ssl-version.min = 'tlsv1.2'
| ^
dotted key `ssl-version` attempted to extend non-table type (string)
| ^^^^^^^^^^^
cannot extend value of type string with a dotted key
"#]],
);

View File

@ -402,7 +402,7 @@ Caused by:
|
1 | abc
| ^
expected `.`, `=`
key with no value, expected `=`
"#]],
);
@ -580,7 +580,7 @@ Caused by:
|
1 | missing.toml
| ^
expected `.`, `=`
key with no value, expected `=`
"#]],
);

View File

@ -1277,8 +1277,7 @@ fn unused_ambiguous_published_deps() {
p.cargo("build").run();
p.cargo("run")
.with_stderr_data(str![[r#"
[ERROR] invalid table header
expected `.`, `]`
[ERROR] unclosed table, expected `]`
--> ../home/.cargo/git/checkouts/dep-[HASH]/[..]/invalid/Cargo.toml:2:29
|
2 | [package
@ -2809,11 +2808,11 @@ fn invalid_git_dependency_manifest() {
.with_status(101)
.with_stderr_data(str![[r#"
[UPDATING] git repository `[ROOTURL]/dep1`
[ERROR] duplicate key `categories` in table `package`
[ERROR] duplicate key
--> ../home/.cargo/git/checkouts/dep1-[HASH]/[..]/Cargo.toml:9:21
|
9 | categories = ["algorithms"]
| ^
| ^^^^^^^^^^
|
[ERROR] failed to get `dep1` as a dependency of package `foo v0.5.0 ([ROOT]/foo)`

View File

@ -1407,12 +1407,11 @@ fn error_malformed_workspace_root() {
.cwd("bar")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] invalid array
expected `]`
--> ../Cargo.toml:3:24
[ERROR] unclosed array, expected `]`
--> ../Cargo.toml:4:13
|
3 | members = [invalid toml
| ^
4 | ...
| ^
|
"#]])

View File

@ -1120,11 +1120,11 @@ Caused by:
invalid TOML found for metadata
Caused by:
TOML parse error at line 1, column 1
TOML parse error at line 1, column 4
|
1 | v1]
| ^
invalid key
| ^
key with no value, expected `=`
"#]])
.run();

View File

@ -50,8 +50,7 @@ fn toml_deserialize_manifest_error() {
p.cargo("check")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] invalid string
expected `"`, `'`
[ERROR] extra `=`, expected nothing
--> bar/Cargo.toml:8:25
|
8 | foobar == "0.55"

View File

@ -1114,7 +1114,7 @@ fn new_warning_with_corrupt_ws() {
let p = project().file("Cargo.toml", "asdf").build();
p.cargo("new bar").with_stderr_data(str![[r#"
[CREATING] binary (application) `bar` package
[ERROR] expected `.`, `=`
[ERROR] key with no value, expected `=`
--> Cargo.toml:1:5
|
1 | asdf
@ -1395,7 +1395,7 @@ fn error_if_parent_cargo_toml_is_invalid() {
.cwd("bar")
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] expected `.`, `=`
[ERROR] key with no value, expected `=`
--> ../Cargo.toml:1:9
|
1 | Totally not a TOML file