diff options
| author | bors <bors@rust-lang.org> | 2025-09-24 09:55:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-09-24 09:55:21 +0000 |
| commit | e9385f9eea0221ef295a188d49d16f8f5189abf1 (patch) | |
| tree | 933de5ad6cddfff49f5ea48b16cfff7f00be4b59 /compiler | |
| parent | 3e887f5faa673bd1f9f6c95fc5d201598818add4 (diff) | |
| parent | 6617536d147d4bb5b3a15aebad265bc847f68b3e (diff) | |
| download | rust-e9385f9eea0221ef295a188d49d16f8f5189abf1.tar.gz rust-e9385f9eea0221ef295a188d49d16f8f5189abf1.zip | |
Auto merge of #146946 - matthiaskrgr:rollup-fsmrqez, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- rust-lang/rust#146818 (constify {float}::total_cmp())
- rust-lang/rust#146896 (rustc-dev-guide subtree update)
- rust-lang/rust#146898 (Update books)
- rust-lang/rust#146899 (Fix a crash/mislex when more than one frontmatter closing possibility is considered)
- rust-lang/rust#146904 (rust-lang/rust#140368 Mutex/RwLock/ReentrantLock::data_ptr to be const fn)
- rust-lang/rust#146907 (add regression test for issue 146537)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_lexer/src/lib.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index c29ab569f47..f6790f7ed1e 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -599,14 +599,16 @@ impl Cursor<'_> { if potential_closing.is_none() { // a less fortunate recovery if all else fails which finds any dashes preceded by whitespace // on a standalone line. Might be wrong. + let mut base_index = 0; while let Some(closing) = rest.find("---") { let preceding_chars_start = rest[..closing].rfind("\n").map_or(0, |i| i + 1); if rest[preceding_chars_start..closing].chars().all(is_horizontal_whitespace) { // candidate found - potential_closing = Some(closing); + potential_closing = Some(closing + base_index); break; } else { rest = &rest[closing + 3..]; + base_index += closing + 3; } } } |
