Disallow forbidden usage of non-ascii identifiers.
This commit is contained in:
parent
163445ac80
commit
de24ddac0a
10 changed files with 128 additions and 2 deletions
|
|
@ -0,0 +1 @@
|
|||
pub trait Foo {}
|
||||
6
src/test/ui/rfc-2457/mod_file_nonascii_forbidden.rs
Normal file
6
src/test/ui/rfc-2457/mod_file_nonascii_forbidden.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#![feature(non_ascii_idents)]
|
||||
|
||||
mod řųśť; //~ trying to load file for
|
||||
//~^ file not found for
|
||||
|
||||
fn main() {}
|
||||
20
src/test/ui/rfc-2457/mod_file_nonascii_forbidden.stderr
Normal file
20
src/test/ui/rfc-2457/mod_file_nonascii_forbidden.stderr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
error[E0583]: file not found for module `řųśť`
|
||||
--> $DIR/mod_file_nonascii_forbidden.rs:3:1
|
||||
|
|
||||
LL | mod řųśť;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs"
|
||||
|
||||
error[E0754]: trying to load file for module `řųśť` with non ascii identifer name
|
||||
--> $DIR/mod_file_nonascii_forbidden.rs:3:5
|
||||
|
|
||||
LL | mod řųśť;
|
||||
| ^^^^
|
||||
|
|
||||
= help: consider using `#[path]` attribute to specify filesystem path
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0583, E0754.
|
||||
For more information about an error, try `rustc --explain E0583`.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
// check-pass
|
||||
#![feature(non_ascii_idents)]
|
||||
|
||||
#[path="auxiliary/mod_file_nonascii_with_path_allowed-aux.rs"]
|
||||
mod řųśť;
|
||||
|
||||
fn main() {}
|
||||
8
src/test/ui/rfc-2457/mod_inline_nonascii_allowed.rs
Normal file
8
src/test/ui/rfc-2457/mod_inline_nonascii_allowed.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// check-pass
|
||||
#![feature(non_ascii_idents)]
|
||||
|
||||
mod řųśť {
|
||||
const IS_GREAT: bool = true;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
6
src/test/ui/rfc-2457/no_mangle_nonascii_forbidden.rs
Normal file
6
src/test/ui/rfc-2457/no_mangle_nonascii_forbidden.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#![feature(non_ascii_idents)]
|
||||
|
||||
#[no_mangle]
|
||||
pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier
|
||||
|
||||
fn main() {}
|
||||
9
src/test/ui/rfc-2457/no_mangle_nonascii_forbidden.stderr
Normal file
9
src/test/ui/rfc-2457/no_mangle_nonascii_forbidden.stderr
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
error[E0754]: `#[no_mangle]` requires ASCII identifier
|
||||
--> $DIR/no_mangle_nonascii_forbidden.rs:4:1
|
||||
|
|
||||
LL | pub fn řųśť() {}
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0754`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue