Allow lexer to recover from some homoglyphs
This commit is contained in:
parent
27a6a304e2
commit
70c817aee3
6 changed files with 74 additions and 34 deletions
4
src/test/ui/parser/recover-from-homoglyph.rs
Normal file
4
src/test/ui/parser/recover-from-homoglyph.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fn main() {
|
||||
println!(""); //~ ERROR unknown start of token: \u{37e}
|
||||
let x: usize = (); //~ ERROR mismatched types
|
||||
}
|
||||
22
src/test/ui/parser/recover-from-homoglyph.stderr
Normal file
22
src/test/ui/parser/recover-from-homoglyph.stderr
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
error: unknown start of token: \u{37e}
|
||||
--> $DIR/recover-from-homoglyph.rs:2:17
|
||||
|
|
||||
LL | println!("");
|
||||
| ^
|
||||
help: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not
|
||||
|
|
||||
LL | println!("");
|
||||
| ^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/recover-from-homoglyph.rs:3:20
|
||||
|
|
||||
LL | let x: usize = ();
|
||||
| ^^ expected usize, found ()
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found type `()`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue