#E0002: 原始碼中有雙向控制字元
原始碼中有 Unicode 雙向控制字元(U+202A 到 U+202E、U+2066 到 U+2069)。這些字元會改變文字的顯示順序,讓你讀到的程式碼與編譯器看到的不同。下例中,字串 "abcdef" 在 abc 與 def 之間藏了一個。在字串中請把它寫成跳脫序列 "\u{202E}",在其他地方則一律刪除;快速修正會直接刪除它。註解也不例外。
error[E0002]: bidirectional control character U+202E RIGHT-TO-LEFT OVERRIDE in source: it can make code read differently from what the compiler sees --> main.nabi:1:17
把這個字元寫成跳脫序列:
nabi
let label = "abc\u{202E}def";
println(f"{label.len()}");
9
相關錯誤碼:E0001 原始碼中有非預期的字元、E0006 字面值中無效的跳脫序列
發現錯誤? 在 GitHub 上編輯此頁 最後更新: