File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
tests/testsuite/script/rustc_fixtures Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,19 @@ impl<'s> ScriptSource<'s> {
95
95
// Ends with a line that starts with a matching number of `-` only followed by whitespace
96
96
let nl_fence_pattern = format ! ( "\n {fence_pattern}" ) ;
97
97
let Some ( frontmatter_nl) = input. find_slice ( nl_fence_pattern. as_str ( ) ) else {
98
+ for len in ( 2 ..( nl_fence_pattern. len ( ) - 1 ) ) . rev ( ) {
99
+ let Some ( frontmatter_nl) = input. find_slice ( & nl_fence_pattern[ 0 ..len] ) else {
100
+ continue ;
101
+ } ;
102
+ let _ = input. next_slice ( frontmatter_nl. start + 1 ) ;
103
+ let close_start = input. current_token_start ( ) ;
104
+ let _ = input. next_slice ( len) ;
105
+ let close_end = input. current_token_start ( ) ;
106
+ return Err ( FrontmatterError :: new (
107
+ format ! ( "closing code fence has too few `-`" ) ,
108
+ close_start..close_end,
109
+ ) ) ;
110
+ }
98
111
return Err ( FrontmatterError :: new (
99
112
format ! ( "no closing `{fence_pattern}` found for frontmatter" ) ,
100
113
open_start..open_end,
Original file line number Diff line number Diff line change 1
- [ERROR] no closing `----` found for frontmatter
2
- --> script:1 :1
1
+ [ERROR] closing code fence has too few `-`
2
+ --> script:3 :1
3
3
|
4
- 1 | - ---cargo
5
- | ^^^^
4
+ 3 | ---cargo
5
+ | ^^^
You can’t perform that action at this time.
0 commit comments