diff --git a/crates/toml/tests/testsuite/de_errors.rs b/crates/toml/tests/testsuite/de_errors.rs index b3630bd4..9773d928 100644 --- a/crates/toml/tests/testsuite/de_errors.rs +++ b/crates/toml/tests/testsuite/de_errors.rs @@ -271,7 +271,7 @@ unknown field `c_d`, expected `c_a` or `c_b` TOML parse error at line 6, column 13 | 6 | [[p_b]] - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^ missing field `c_b` " ); diff --git a/crates/toml_edit/src/error.rs b/crates/toml_edit/src/error.rs index bada6670..57aa3df3 100644 --- a/crates/toml_edit/src/error.rs +++ b/crates/toml_edit/src/error.rs @@ -125,7 +125,7 @@ impl Display for TomlError { // The span will be empty at eof, so we need to make sure we always print at least // one `^` write!(f, "^")?; - for _ in (span.start + 1)..(span.end.min(span.start + content.len())) { + for _ in (span.start + 1)..(span.end.min(span.start + content.len() - column)) { write!(f, "^")?; } writeln!(f)?;