Skip to content

Commit 539a484

Browse files
committed
perf: Update toml
1 parent 8f80388 commit 539a484

File tree

18 files changed

+129
-80
lines changed

18 files changed

+129
-80
lines changed

Cargo.lock

Lines changed: 75 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ tar = { version = "0.4.44", default-features = false }
105105
tempfile = "3.20.0"
106106
thiserror = "2.0.12"
107107
time = { version = "0.3.41", features = ["parsing", "formatting", "serde"] }
108-
toml = { version = "0.8.23", default-features = false }
109-
toml_edit = { version = "0.22.27", features = ["serde"] }
108+
toml = { version = "0.9.0", default-features = false }
109+
toml_edit = { version = "0.23.0", features = ["serde"] }
110110
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
111111
tracing-chrome = "0.7.2"
112112
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
@@ -211,7 +211,7 @@ tar.workspace = true
211211
tempfile.workspace = true
212212
thiserror.workspace = true
213213
time.workspace = true
214-
toml = { workspace = true, features = ["display", "parse"] }
214+
toml = { workspace = true, features = ["std", "serde", "parse", "display"] }
215215
toml_edit.workspace = true
216216
tracing = { workspace = true, features = ["attributes"] }
217217
tracing-subscriber.workspace = true

benches/capture/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ publish = false
1010
cargo_metadata.workspace = true
1111
flate2.workspace = true
1212
tar.workspace = true
13-
toml = { workspace = true, features = ["display", "parse"] }
13+
toml = { workspace = true, features = ["display", "parse", "serde"] }
1414

1515
[lints]
1616
workspace = true

crates/cargo-test-support/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ serde_json.workspace = true
2727
snapbox.workspace = true
2828
tar.workspace = true
2929
time.workspace = true
30-
toml = { workspace = true, features = ["display"] }
30+
toml = { workspace = true, features = ["display", "serde"] }
3131
url.workspace = true
3232
walkdir.workspace = true
3333

crates/cargo-util-schemas/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ serde_json = { workspace = true, optional = true }
1616
serde-untagged.workspace = true
1717
serde-value.workspace = true
1818
thiserror.workspace = true
19-
toml.workspace = true
19+
toml = { workspace = true, features = ["serde"] }
2020
unicode-xid.workspace = true
2121
url.workspace = true
2222

src/cargo/util/context/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,9 @@ impl GlobalContext {
10431043
let def = Definition::Environment(key.as_env_key().to_string());
10441044
if self.cli_unstable().advanced_env && env_val.starts_with('[') && env_val.ends_with(']') {
10451045
// Parse an environment string as a TOML array.
1046-
let toml_v = toml::Value::deserialize(toml::de::ValueDeserializer::new(&env_val))
1047-
.map_err(|e| {
1048-
ConfigError::new(format!("could not parse TOML list: {}", e), def.clone())
1049-
})?;
1046+
let toml_v = env_val.parse::<toml::Value>().map_err(|e| {
1047+
ConfigError::new(format!("could not parse TOML list: {}", e), def.clone())
1048+
})?;
10501049
let values = toml_v.as_array().expect("env var was not array");
10511050
for value in values {
10521051
// TODO: support other types.

tests/testsuite/alt_registry.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,13 +751,11 @@ fn bad_registry_name() {
751751
[ERROR] invalid character ` ` in registry name: `bad name`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
752752
753753
754-
--> Cargo.toml:8:17
755-
|
756-
8 | / [dependencies.bar]
757-
9 | | version = "0.0.1"
758-
10 | | registry = "bad name"
759-
| |_____________________________________^
760-
|
754+
--> Cargo.toml:8:17
755+
|
756+
8 | [dependencies.bar]
757+
| ^^^^^^^^^^^^^^^^^^
758+
|
761759
762760
"#]])
763761
.run();

tests/testsuite/bad_config.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Caused by:
172172
|
173173
1 | 4
174174
| ^
175-
expected `.`, `=`
175+
key with no value, expected `=`
176176
177177
"#]])
178178
.run();
@@ -454,8 +454,7 @@ fn malformed_override() {
454454
p.cargo("check")
455455
.with_status(101)
456456
.with_stderr_data(str![[r#"
457-
[ERROR] invalid inline table
458-
expected `}`
457+
[ERROR] newlines are unsupported in inline tables, expected nothing
459458
--> Cargo.toml:9:27
460459
|
461460
9 | native = {
@@ -2130,8 +2129,7 @@ Caused by:
21302129
|
21312130
1 | [bar] baz = 2
21322131
| ^
2133-
invalid table header
2134-
expected newline, `#`
2132+
unexpected key or value, expected newline, `#`
21352133
21362134
"#]])
21372135
.run();

tests/testsuite/build.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,11 @@ Caused by:
377377
could not parse TOML configuration in `[ROOT]/foo/.cargo/config.toml`
378378
379379
Caused by:
380-
TOML parse error at line 1, column 1
380+
TOML parse error at line 1, column 2
381381
|
382382
1 | !
383-
| ^
384-
invalid key
383+
| ^
384+
key with no value, expected `=`
385385
386386
"#]])
387387
.run();
@@ -418,12 +418,11 @@ fn cargo_compile_with_invalid_manifest2() {
418418
p.cargo("build")
419419
.with_status(101)
420420
.with_stderr_data(str![[r#"
421-
[ERROR] invalid string
422-
expected `"`, `'`
421+
[ERROR] string values must be quoted, expected literal string
423422
--> Cargo.toml:3:23
424423
|
425424
3 | foo = bar
426-
| ^
425+
| ^^^
427426
|
428427
429428
"#]])
@@ -437,12 +436,11 @@ fn cargo_compile_with_invalid_manifest3() {
437436
p.cargo("build --manifest-path src/Cargo.toml")
438437
.with_status(101)
439438
.with_stderr_data(str![[r#"
440-
[ERROR] invalid string
441-
expected `"`, `'`
439+
[ERROR] string values must be quoted, expected literal string
442440
--> src/Cargo.toml:1:5
443441
|
444442
1 | a = bar
445-
| ^
443+
| ^^^
446444
|
447445
448446
"#]])
@@ -2740,7 +2738,7 @@ Caused by:
27402738
|
27412739
1 | this is not valid toml
27422740
| ^
2743-
expected `.`, `=`
2741+
key with no value, expected `=`
27442742
27452743
"#]])
27462744
.run();

tests/testsuite/cargo_add/invalid_manifest/stderr.term.svg

Lines changed: 8 additions & 10 deletions
Loading

0 commit comments

Comments
 (0)