fix: toml now have a better way to capture error spans

This commit is contained in:
rvcas 2023-03-06 13:15:48 -05:00
parent 92161bed43
commit 79c2cb3062
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
3 changed files with 9 additions and 9 deletions

View File

@ -88,9 +88,9 @@ impl Config {
src: raw_config.clone(), src: raw_config.clone(),
named: NamedSource::new(config_path.display().to_string(), raw_config).into(), named: NamedSource::new(config_path.display().to_string(), raw_config).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.span().map(|range| Span {
start: line, start: range.start,
end: col, end: range.end,
}), }),
help: e.to_string(), help: e.to_string(),
})?; })?;

View File

@ -48,9 +48,9 @@ impl LocalPackages {
src: src.clone(), src: src.clone(),
named: NamedSource::new(path.display().to_string(), src).into(), named: NamedSource::new(path.display().to_string(), src).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.span().map(|range| Span {
start: line, start: range.start,
end: col, end: range.end,
}), }),
help: e.to_string(), help: e.to_string(),
})?; })?;

View File

@ -54,9 +54,9 @@ impl Manifest {
src: toml.clone(), src: toml.clone(),
named: NamedSource::new(manifest_path.display().to_string(), toml).into(), named: NamedSource::new(manifest_path.display().to_string(), toml).into(),
// this isn't actually a legit way to get the span // this isn't actually a legit way to get the span
location: e.line_col().map(|(line, col)| Span { location: e.span().map(|range| Span {
start: line, start: range.start,
end: col, end: range.end,
}), }),
help: e.to_string(), help: e.to_string(),
})?; })?;