Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "a_name"
version = "0.1.0"
edition = "2024"

[dependencies]
crate1 = { version = "0.1.0" }
crate2 = { version = "1.0.0", features=[] }

[patch.crates-io]
crate3."path = "../somewhere"
crate4."path = "/somewhere"
crate5 = { "path = "../somewhere" }
crate6 = { "path = "/somewhere" }

[patch.crates-io.crate7]
"path = "../somewhere"

[patch.crates-io.crate8]
"path = "/somewhere"
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
TOML parse error at line 11, column 30
|
11 | crate3."path = "../somewhere"
| ^
key with no value, expected `=`

---
TOML parse error at line 12, column 17
|
12 | crate4."path = "/somewhere"
| ^
key with no value, expected `=`

---
TOML parse error at line 14, column 21
|
14 | crate6 = { "path = "/somewhere" }
| ^
missing assignment between key-value pairs, expected `=`

---
TOML parse error at line 17, column 23
|
17 | "path = "../somewhere"
| ^
key with no value, expected `=`

---
TOML parse error at line 20, column 10
|
20 | "path = "/somewhere"
| ^
key with no value, expected `=`

---
TOML parse error at line 11, column 18
|
11 | crate3."path = "../somewhere"
| ^
unquoted keys cannot be empty, expected letters, numbers, `-`, `_`

---
TOML parse error at line 11, column 19
|
11 | crate3."path = "../somewhere"
| ^
invalid basic string, expected `"`
12 changes: 6 additions & 6 deletions crates/toml/tests/snapshots/invalid/key/partial-quoted.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
TOML parse error at line 1, column 8
TOML parse error at line 1, column 1
|
1 | partial"quoted" = 5
| ^
invalid unquoted key, expected letters, numbers, `-`, `_`
| ^
invalid basic string, expected `"`

---
TOML parse error at line 1, column 15
TOML parse error at line 1, column 8
|
1 | partial"quoted" = 5
| ^
invalid unquoted key, expected letters, numbers, `-`, `_`
| ^
invalid basic string, expected non-double-quote visible characters, `\`
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "a_name"
version = "0.1.0"
edition = "2024"

[dependencies]
crate1 = { version = "0.1.0" }
crate2 = { version = "1.0.0", features=[] }

[patch.crates-io]
crate3."path = "../somewhere"
crate4."path = "/somewhere"
crate5 = { "path = "../somewhere" }
crate6 = { "path = "/somewhere" }

[patch.crates-io.crate7]
"path = "../somewhere"

[patch.crates-io.crate8]
"path = "/somewhere"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TOML parse error at line 11, column 30
|
11 | crate3."path = "../somewhere"
| ^
key with no value, expected `=`
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TOML parse error at line 1, column 8
TOML parse error at line 1, column 1
|
1 | partial"quoted" = 5
| ^
invalid unquoted key, expected letters, numbers, `-`, `_`
| ^
invalid basic string, expected `"`
10 changes: 10 additions & 0 deletions crates/toml_parser/src/decoder/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,16 @@ pub(crate) fn decode_unquoted_key<'i>(
) {
let s = raw.as_str();

if s.ends_with("'''") {
return decode_ml_literal_string(raw, output, error);
} else if s.ends_with("\"\"\"") {
return decode_ml_basic_string(raw, output, error);
} else if s.ends_with("'") {
return decode_literal_string(raw, output, error);
} else if s.ends_with("\"") {
return decode_basic_string(raw, output, error);
}

if s.is_empty() {
error.report_error(
ParseError::new("unquoted keys cannot be empty")
Expand Down
Loading
Loading