diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-17 16:24:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-17 16:24:26 +0200 |
| commit | 49b81cae86f0b72d0351ad925aa8efde47ca6109 (patch) | |
| tree | 244424f5c8195ebc983821e922dc5480f86ae76b /src/librustc_error_codes | |
| parent | 7faeae0d385730e712634fb2af331ea0140771b4 (diff) | |
| parent | de24ddac0a80a6e16de1bfbfade772648cf66e18 (diff) | |
Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov
Disallow forbidden usage of non-ascii identifiers. Part of RFC2457, this tightens allowed identifiers back to ascii only in two situations. r? @petrochenkov
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() {} +``` |
