-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Labels
A-errorArea: Error reportingArea: Error reportingA-serdeArea: Serde integrationArea: Serde integrationC-bugCategory: Things not working as expectedCategory: Things not working as expected
Description
Here's a link to my example/repro:
and inline for convenience:
use serde::Deserialize;
use std::collections::HashMap;
#[derive(Deserialize, Debug)]
struct Thing {
#[serde(flatten)]
entries: HashMap<String, Entry>,
}
#[derive(Deserialize, Debug)]
struct Entry {
foo: u32,
}
fn main() {
let data = "# comment line\n[\"default\"]\nfooo = 42";
match toml::from_str::<Thing>(&data) {
Ok(data) => println!("{data:#?}"),
Err(err) => println!("{err:#}"),
}
}
produces:
TOML parse error at line 1, column 1
|
1 | # comment line
| ^
missing field `foo`
I would expect the line number to be 3 rather than 1, and for the context in the error message to refer to the appropriate part of the file.
ehuss and DianaNites
Metadata
Metadata
Assignees
Labels
A-errorArea: Error reportingArea: Error reportingA-serdeArea: Serde integrationArea: Serde integrationC-bugCategory: Things not working as expectedCategory: Things not working as expected