From de24ddac0a80a6e16de1bfbfade772648cf66e18 Mon Sep 17 00:00:00 2001 From: Charles Lew Date: Sat, 16 May 2020 14:09:01 +0800 Subject: Disallow forbidden usage of non-ascii identifiers. --- src/librustc_error_codes/error_codes/E0754.md | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/librustc_error_codes/error_codes/E0754.md (limited to 'src/librustc_error_codes/error_codes') diff --git a/src/librustc_error_codes/error_codes/E0754.md b/src/librustc_error_codes/error_codes/E0754.md new file mode 100644 index 00000000000..abdc01ed21a --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0754.md @@ -0,0 +1,33 @@ +An non-ascii identifier was used in an invalid context. + +Erroneous code example: + +```compile_fail,E0754 +# #![feature(non_ascii_idents)] + +mod řųśť; +// ^ error! +fn main() {} +``` + +```compile_fail,E0754 +# #![feature(non_ascii_idents)] + +#[no_mangle] +fn řųśť() {} +// ^ error! +fn main() {} +``` + +Non-ascii can be used as module names if it is inline +or a #\[path\] attribute is specified. For example: + +``` +# #![feature(non_ascii_idents)] + +mod řųśť { + const IS_GREAT: bool = true; +} + +fn main() {} +``` -- cgit 1.4.1-3-g733a5