Code
#[allow(unused)]
/// א, ב, ג, ד, ה
fn foo() {}
Current output
error: unicode codepoint changing visible direction of text present in doc comment
--> src/lib.rs:3:1
|
3 | /// �א�, �ב�, �ג�, �ד�, �ה�
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints
|
= note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen
= note: if their presence wasn't intentional, you can remove them
= note: if you want to keep them but make them visible in your source code, you can escape them: '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}'
= note: `#[deny(text_direction_codepoint_in_literal)]` on by default
Desired output
error: unicode codepoint changing visible direction of text present in doc comment
--> src/lib.rs:3:1
|
3 | /// �א�, �ב�, �ג�, �ד�, �ה�
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints
|
= note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen
= note: if their presence wasn't intentional, you can remove them
= note: `#[deny(text_direction_codepoint_in_literal)]` on by default
Rationale and extra context
Note that the doc comment in the reproduction code contains U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE characters. Playground permalink: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=44bd4e97766544992e996fa8bb14b889.
The issue with the current suggestion is that Unicode escapes (\u{xxxx}) do not work in doc comments, so the suggestion is incorrect. Maybe it should instead suggest using the HTML tags listed at https://www.w3.org/International/questions/qa-bidi-unicode-controls.
Other cases
Rust Version
rustc 1.93.1 (01f6ddf75 2026-02-11)
binary: rustc
commit-hash: 01f6ddf7588f42ae2d7eb0a2f21d44e8e96674cf
commit-date: 2026-02-11
host: x86_64-pc-windows-gnu
release: 1.93.1
LLVM version: 21.1.8
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
Note that the doc comment in the reproduction code contains U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE characters. Playground permalink: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=44bd4e97766544992e996fa8bb14b889.
The issue with the current suggestion is that Unicode escapes (
\u{xxxx}) do not work in doc comments, so the suggestion is incorrect. Maybe it should instead suggest using the HTML tags listed at https://www.w3.org/International/questions/qa-bidi-unicode-controls.Other cases
Rust Version
Anything else?
No response