Skip to content

Commit

Permalink
gccrs: Add tests for Unicode identifiers
Browse files Browse the repository at this point in the history
gcc/testsuite/ChangeLog:

	* rust/compile/torture/raw_identifiers.rs: New test.
	* rust/compile/torture/utf8_identifiers.rs: New test.

Signed-off-by: Raiki Tamura <tamaron1203@gmail.com>
  • Loading branch information
tamaroning committed Jun 28, 2023
1 parent 760ed46 commit e9d08e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gcc/testsuite/rust/compile/torture/raw_identifiers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
pub fn square(num: i32) -> i32 {
r#num * num
}

pub fn kimchi() -> i32 {
// UTF-8 raw indentifiers
let r#김치 = 1;
let r#泡菜 = 1;
let r#кимчи = 1;
r#김치 + r#泡菜 + r#кимчи
}
18 changes: 18 additions & 0 deletions gcc/testsuite/rust/compile/torture/utf8_identifiers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pub fn f() {
let crab = ();

let Κάβουρας = 0.001;
// { dg-warning "unused name" "" { target *-*-* } .-1 }
let 게 = "";
// { dg-warning "unused name" "" { target *-*-* } .-1 }
let سلطعون = 0.;
// { dg-warning "unused name" "" { target *-*-* } .-1 }

let _: &'かに () = &crab;
}

pub fn g<'β, γ>() {}

struct _S {
δ: i32
}

0 comments on commit e9d08e5

Please sign in to comment.