diff options
Diffstat (limited to 'tests/ui/rfc-2457')
14 files changed, 154 insertions, 0 deletions
diff --git a/tests/ui/rfc-2457/auxiliary/mod_file_nonascii_with_path_allowed-aux.rs b/tests/ui/rfc-2457/auxiliary/mod_file_nonascii_with_path_allowed-aux.rs new file mode 100644 index 000000000..e373b6438 --- /dev/null +++ b/tests/ui/rfc-2457/auxiliary/mod_file_nonascii_with_path_allowed-aux.rs @@ -0,0 +1 @@ +pub trait Foo {} diff --git a/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.rs b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.rs new file mode 100644 index 000000000..c07ba54af --- /dev/null +++ b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.rs @@ -0,0 +1,3 @@ +extern crate ьаг; //~ ERROR cannot load a crate with a non-ascii name `ьаг` + +fn main() {} diff --git a/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.stderr b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.stderr new file mode 100644 index 000000000..a8f3abe59 --- /dev/null +++ b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-1.stderr @@ -0,0 +1,8 @@ +error: cannot load a crate with a non-ascii name `ьаг` + --> $DIR/crate_name_nonascii_forbidden-1.rs:1:1 + | +LL | extern crate ьаг; + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.rs b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.rs new file mode 100644 index 000000000..f8e033937 --- /dev/null +++ b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.rs @@ -0,0 +1,6 @@ +// compile-flags:--extern му_сгате +// edition:2018 + +use му_сгате::baz; //~ ERROR cannot load a crate with a non-ascii name `му_сгате` + +fn main() {} diff --git a/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.stderr b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.stderr new file mode 100644 index 000000000..05fc4fb22 --- /dev/null +++ b/tests/ui/rfc-2457/crate_name_nonascii_forbidden-2.stderr @@ -0,0 +1,8 @@ +error: cannot load a crate with a non-ascii name `му_сгате` + --> $DIR/crate_name_nonascii_forbidden-2.rs:4:5 + | +LL | use му_сгате::baz; + | ^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/rfc-2457/extern_block_nonascii_forbidden.rs b/tests/ui/rfc-2457/extern_block_nonascii_forbidden.rs new file mode 100644 index 000000000..ad6825404 --- /dev/null +++ b/tests/ui/rfc-2457/extern_block_nonascii_forbidden.rs @@ -0,0 +1,9 @@ +#![feature(extern_types)] + +extern "C" { + type 一; //~ items in `extern` blocks cannot use non-ascii identifiers + fn 二(); //~ items in `extern` blocks cannot use non-ascii identifiers + static 三: usize; //~ items in `extern` blocks cannot use non-ascii identifiers +} + +fn main() {} diff --git a/tests/ui/rfc-2457/extern_block_nonascii_forbidden.stderr b/tests/ui/rfc-2457/extern_block_nonascii_forbidden.stderr new file mode 100644 index 000000000..ca1b8a6e7 --- /dev/null +++ b/tests/ui/rfc-2457/extern_block_nonascii_forbidden.stderr @@ -0,0 +1,34 @@ +error: items in `extern` blocks cannot use non-ascii identifiers + --> $DIR/extern_block_nonascii_forbidden.rs:4:10 + | +LL | extern "C" { + | ---------- in this `extern` block +LL | type 一; + | ^^ + | + = note: this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information + +error: items in `extern` blocks cannot use non-ascii identifiers + --> $DIR/extern_block_nonascii_forbidden.rs:5:8 + | +LL | extern "C" { + | ---------- in this `extern` block +LL | type 一; +LL | fn 二(); + | ^^ + | + = note: this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information + +error: items in `extern` blocks cannot use non-ascii identifiers + --> $DIR/extern_block_nonascii_forbidden.rs:6:12 + | +LL | extern "C" { + | ---------- in this `extern` block +... +LL | static 三: usize; + | ^^ + | + = note: this limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information + +error: aborting due to 3 previous errors + diff --git a/tests/ui/rfc-2457/idents-normalized.rs b/tests/ui/rfc-2457/idents-normalized.rs new file mode 100644 index 000000000..1023fee37 --- /dev/null +++ b/tests/ui/rfc-2457/idents-normalized.rs @@ -0,0 +1,7 @@ +// check-pass + +struct Résumé; // ['LATIN SMALL LETTER E WITH ACUTE'] + +fn main() { + let _ = Résumé; // ['LATIN SMALL LETTER E', 'COMBINING ACUTE ACCENT'] +} diff --git a/tests/ui/rfc-2457/mod_file_nonascii_forbidden.rs b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.rs new file mode 100644 index 000000000..e949e2319 --- /dev/null +++ b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.rs @@ -0,0 +1,4 @@ +mod řųśť; //~ trying to load file for +//~^ file not found for + +fn main() {} diff --git a/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr new file mode 100644 index 000000000..dd0dac95e --- /dev/null +++ b/tests/ui/rfc-2457/mod_file_nonascii_forbidden.stderr @@ -0,0 +1,20 @@ +error[E0583]: file not found for module `řųśť` + --> $DIR/mod_file_nonascii_forbidden.rs:1:1 + | +LL | mod řųśť; + | ^^^^^^^^^ + | + = help: to create the module `řųśť`, create file "$DIR/řųśť.rs" or "$DIR/řųśť/mod.rs" + +error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name + --> $DIR/mod_file_nonascii_forbidden.rs:1: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`. diff --git a/tests/ui/rfc-2457/mod_file_nonascii_with_path_allowed.rs b/tests/ui/rfc-2457/mod_file_nonascii_with_path_allowed.rs new file mode 100644 index 000000000..94327846d --- /dev/null +++ b/tests/ui/rfc-2457/mod_file_nonascii_with_path_allowed.rs @@ -0,0 +1,6 @@ +// check-pass + +#[path="auxiliary/mod_file_nonascii_with_path_allowed-aux.rs"] +mod řųśť; + +fn main() {} diff --git a/tests/ui/rfc-2457/mod_inline_nonascii_allowed.rs b/tests/ui/rfc-2457/mod_inline_nonascii_allowed.rs new file mode 100644 index 000000000..e1d836b7c --- /dev/null +++ b/tests/ui/rfc-2457/mod_inline_nonascii_allowed.rs @@ -0,0 +1,7 @@ +// check-pass + +mod řųśť { + const IS_GREAT: bool = true; +} + +fn main() {} diff --git a/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.rs b/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.rs new file mode 100644 index 000000000..f4c126a6e --- /dev/null +++ b/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.rs @@ -0,0 +1,20 @@ +#[no_mangle] +pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier + +pub struct Foo; + +impl Foo { + #[no_mangle] + pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier +} + +trait Bar { + fn řųśť(); +} + +impl Bar for Foo { + #[no_mangle] + fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier +} + +fn main() {} diff --git a/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.stderr b/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.stderr new file mode 100644 index 000000000..459d5d6b5 --- /dev/null +++ b/tests/ui/rfc-2457/no_mangle_nonascii_forbidden.stderr @@ -0,0 +1,21 @@ +error[E0754]: `#[no_mangle]` requires ASCII identifier + --> $DIR/no_mangle_nonascii_forbidden.rs:2:1 + | +LL | pub fn řųśť() {} + | ^^^^^^^^^^^^^ + +error[E0754]: `#[no_mangle]` requires ASCII identifier + --> $DIR/no_mangle_nonascii_forbidden.rs:8:5 + | +LL | pub fn řųśť() {} + | ^^^^^^^^^^^^^ + +error[E0754]: `#[no_mangle]` requires ASCII identifier + --> $DIR/no_mangle_nonascii_forbidden.rs:17:5 + | +LL | fn řųśť() {} + | ^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0754`. |