diff options
| author | Charles Lew <crlf0710@gmail.com> | 2020-05-16 14:09:01 +0800 |
|---|---|---|
| committer | Charles Lew <crlf0710@gmail.com> | 2020-05-17 01:31:18 +0800 |
| commit | de24ddac0a80a6e16de1bfbfade772648cf66e18 (patch) | |
| tree | ecf4544c98229fcf0e53e7cb3bc29473668edb90 /src/librustc_error_codes | |
| parent | 163445ac80225090c81e7ff1b185fb5dca52e3b2 (diff) | |
| download | rust-de24ddac0a80a6e16de1bfbfade772648cf66e18.tar.gz rust-de24ddac0a80a6e16de1bfbfade772648cf66e18.zip | |
Disallow forbidden usage of non-ascii identifiers.
Diffstat (limited to 'src/librustc_error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 1 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0754.md | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 2399e99a309..d6863c615f6 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -436,6 +436,7 @@ E0750: include_str!("./error_codes/E0750.md"), E0751: include_str!("./error_codes/E0751.md"), E0752: include_str!("./error_codes/E0752.md"), E0753: include_str!("./error_codes/E0753.md"), +E0754: include_str!("./error_codes/E0754.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard 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() {} +``` |
