Skip to content

Commit b6326d3

Browse files
committed
fix(frontmatter): Have too few error match too many on close
1 parent 0cbd02f commit b6326d3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cargo/util/frontmatter.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ impl<'s> ScriptSource<'s> {
103103
let close_start = input.current_token_start();
104104
let _ = input.next_slice(len);
105105
let close_end = input.current_token_start();
106+
let fewer_dashes = fence_length - len;
106107
return Err(FrontmatterError::new(
107-
format!("closing code fence has too few `-`"),
108+
format!(
109+
"closing code fence has {fewer_dashes} less `-` than the opening fence"
110+
),
108111
close_start..close_end,
109112
));
110113
}

tests/testsuite/script/rustc_fixtures/mismatch-2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[ERROR] closing code fence has too few `-`
1+
[ERROR] closing code fence has 1 less `-` than the opening fence
22
--> script:3:1
33
|
44
3 | ---cargo

0 commit comments

Comments
 (0)