File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -545,11 +545,12 @@ impl Cursor<'_> {
545
545
546
546
let mut s = self . as_str ( ) ;
547
547
let mut found = false ;
548
+ let mut size = 0 ;
548
549
while let Some ( closing) = s. find ( & "-" . repeat ( length_opening as usize ) ) {
549
550
let preceding_chars_start = s[ ..closing] . rfind ( "\n " ) . map_or ( 0 , |i| i + 1 ) ;
550
551
if s[ preceding_chars_start..closing] . chars ( ) . all ( is_whitespace) {
551
552
// candidate found
552
- self . bump_bytes ( closing) ;
553
+ self . bump_bytes ( size + closing) ;
553
554
// in case like
554
555
// ---cargo
555
556
// --- blahblah
@@ -562,6 +563,7 @@ impl Cursor<'_> {
562
563
break ;
563
564
} else {
564
565
s = & s[ closing + length_opening as usize ..] ;
566
+ size += closing + length_opening as usize ;
565
567
}
566
568
}
567
569
Original file line number Diff line number Diff line change
1
+ ---
2
+ x ---🚧️
3
+ ---
4
+
5
+ // Regression test for #141483
6
+ //@check-pass
7
+
8
+ #![ feature ( frontmatter) ]
9
+
10
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ ---
2
+ x ---y
3
+ ---
4
+
5
+ // Test that hypens are allowed inside frontmatters if there is some
6
+ // non-whitespace character preceding them.
7
+ //@check-pass
8
+
9
+ #![ feature ( frontmatter) ]
10
+
11
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments