[−][src]Static rustc_lint::non_ascii_idents::CONFUSABLE_IDENTS

pub static CONFUSABLE_IDENTS: &Lint

The confusable_idents lint detects visually confusable pairs between identifiers.

Example

#![feature(non_ascii_idents)]

// Latin Capital Letter E With Caron
pub const Ě: i32 = 1;
// Latin Capital Letter E With Breve
pub const Ĕ: i32 = 2;

{{produces}}

Explanation

With the non_ascii_idents nightly-only feature enabled, identifiers are allowed to use non-ASCII characters. This lint warns when different identifiers may appear visually similar, which can cause confusion.

The confusable detection algorithm is based on Unicode® Technical Standard #39 Unicode Security Mechanisms Section 4 Confusable Detection. For every distinct identifier X execute the function skeleton(X). If there exist two distinct identifiers X and Y in the same crate where skeleton(X) = skeleton(Y) report it. The compiler uses the same mechanism to check if an identifier is too similar to a keyword.

Note that the set of confusable characters may change over time. Beware that if you "forbid" this lint that existing code may fail in the future.