TEXT_DIRECTION_CODEPOINT_IN_COMMENT in rustc_lint_defs::builtin - Rust
Description: The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that change the visual representation of text on screen in a way that does not correspond to their on memory representation.

Skip to main content

## TEXT_DIRECTION_CODEPOINT_IN_COMMENT

# Static TEXT_DIRECTION_CODEPOINT_IN_COMMENT

Source

    pub static TEXT_DIRECTION_CODEPOINT_IN_COMMENT: &Lint

Expand description

The `text_direction_codepoint_in_comment` lint detects Unicode codepoints in comments that change the visual representation of text on screen in a way that does not correspond to their on memory representation.

#### §Example

ⓘ

    #![deny(text_direction_codepoint_in_comment)]
    fn main() {
       println!("{:?}"); // '‮');
    }

{{produces}}

#### §Explanation

Unicode allows changing the visual flow of text on screen in order to support scripts that are written right-to-left, but a specially crafted comment can make code that will be compiled appear to be part of a comment, depending on the software used to read the code. To avoid potential problems or confusion, such as in CVE-2021-42574, by default we deny their use.