mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 00:34:06 +00:00
Add double-equals homoglyph
This commit is contained in:
parent
3520bba136
commit
1487aa9f9d
@ -296,6 +296,7 @@ pub(crate) const UNICODE_ARRAY: &[(char, &str, &str)] = &[
|
||||
('〉', "Right Angle Bracket", ">"),
|
||||
('》', "Right Double Angle Bracket", ">"),
|
||||
('>', "Fullwidth Greater-Than Sign", ">"),
|
||||
('⩵', "Two Consecutive Equals Signs", "==")
|
||||
];
|
||||
|
||||
// FIXME: the lexer could be used to turn the ASCII version of unicode homoglyphs, instead of
|
||||
@ -325,6 +326,7 @@ const ASCII_ARRAY: &[(&str, &str, Option<token::TokenKind>)] = &[
|
||||
("+", "Plus Sign", Some(token::BinOp(token::Plus))),
|
||||
("<", "Less-Than Sign", Some(token::Lt)),
|
||||
("=", "Equals Sign", Some(token::Eq)),
|
||||
("==", "Double Equals Sign", Some(token::EqEq)),
|
||||
(">", "Greater-Than Sign", Some(token::Gt)),
|
||||
// FIXME: Literals are already lexed by this point, so we can't recover gracefully just by
|
||||
// spitting the correct token out.
|
||||
|
@ -6,4 +6,7 @@ fn main() {
|
||||
//~^ ERROR unknown start of token: \u{a0}
|
||||
//~^^ NOTE character appears 3 more times
|
||||
//~^^^ HELP Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is not
|
||||
let _ = 1 ⩵ 2;
|
||||
//~^ ERROR unknown start of token
|
||||
//~^^ HELP Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not
|
||||
}
|
||||
|
@ -21,5 +21,16 @@ help: Unicode character ' ' (No-Break Space) looks like ' ' (Space), but it is
|
||||
LL | let x = 0;
|
||||
| ++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: unknown start of token: \u{2a75}
|
||||
--> $DIR/unicode-chars.rs:9:15
|
||||
|
|
||||
LL | let _ = 1 ⩵ 2;
|
||||
| ^
|
||||
|
|
||||
help: Unicode character '⩵' (Two Consecutive Equals Signs) looks like '==' (Double Equals Sign), but it is not
|
||||
|
|
||||
LL | let _ = 1 == 2;
|
||||
| ~~
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user