Files
rust/tests/rustdoc-html
Pavel Lazureykis 54941bef4f rustdoc: fix ICE when a grapheme cluster joins a Prepend character to _
`EscapeBodyTextWithWbr` iterates `text.grapheme_indices(true)`, so `i` is the
start of a grapheme cluster, but the `_`/`:` word-break arm sliced at `i + 1` --
assuming a cluster containing `_` or `:` is exactly one byte long.

UAX#29 GB9b joins a `Prepend`-class character (U+0600-U+0605, U+0D4E, U+111C2,
...) with the character that follows it, so a cluster can start with a
multi-byte character and still contain `_`. `i + 1` then lands inside that
character and `str` indexing panics. U+0D4E is `XID_Continue`, so this is
reachable from an item name rustc accepts, e.g. `pub struct abc<U+0D4E>_defgh;`,
and rustdoc ICEs instead of documenting the crate.

Break after the whole cluster (`i + s.len()`) instead. The adjacent CamelCase
arm already slices at `i`, which is always a cluster boundary, so it is
unaffected.

This also stops the `<wbr>` from being inserted between `_` and a combining
mark that trails it, which split a grapheme cluster without panicking.
2026-07-30 19:23:18 +00:00
..
2026-07-13 10:54:53 +02:00
2026-06-12 19:11:22 -04:00
2026-04-01 23:05:42 +01:00
…
2026-02-24 11:41:26 -05:00
2026-07-13 10:54:53 +02:00
2026-06-07 11:06:19 +03:00
…
…
…
…
2026-06-07 13:58:33 -04:00
…
…
…
…
2026-07-13 10:54:53 +02:00
…
…
2026-02-10 18:00:54 +00:00
…
…