mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
fix(frontmatter): Be more specific about trailing character span
This commit is contained in:
parent
5b4d0cfad8
commit
b674a60384
@ -150,9 +150,11 @@ impl<'s> ScriptSource<'s> {
|
||||
let after_closing_fence = after_closing_fence.trim_matches(is_whitespace);
|
||||
if !after_closing_fence.is_empty() {
|
||||
// extra characters beyond the original fence pattern
|
||||
let after_start = after_closing_fence.offset_from(&raw);
|
||||
let after_end = after_start + after_closing_fence.len();
|
||||
return Err(FrontmatterError::new(
|
||||
format!("unexpected characters after frontmatter close"),
|
||||
close_end..content_start,
|
||||
after_start..after_end,
|
||||
)
|
||||
.push_visible_span(open_start..open_end));
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
[ERROR] unexpected characters after frontmatter close
|
||||
--> script:2:4
|
||||
|
|
||||
1 | ---
|
||||
2 | ---cargo
|
||||
| ____^
|
||||
3 | | //~^ ERROR: extra characters after frontmatter close are not allowed
|
||||
| |_^
|
||||
1 | ---
|
||||
2 | ---cargo
|
||||
| ^^^^^
|
||||
|
Loading…
x
Reference in New Issue
Block a user