Skip to content

Commit

Permalink
Add test to check unicode identifier version
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Dec 8, 2024
1 parent f33a8c6 commit 35ac908
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod unescape;
mod tests;

use unicode_properties::UnicodeEmoji;
pub use unicode_xid::UNICODE_VERSION;

use self::LiteralKind::*;
use self::TokenKind::*;
Expand Down
18 changes: 18 additions & 0 deletions tests/ui-fulldeps/lexer/unicode-version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This test is used to validate which version of Unicode is used for parsing
// identifiers. If the Unicode version changes, it should also be updated in
// the reference at
// https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md.

//@ run-pass
//@ check-run-results
//@ ignore-cross-compile
//@ reference: ident.unicode

#![feature(rustc_private)]

extern crate rustc_driver;
extern crate rustc_lexer;

fn main() {
println!("Unicode version is: {:?}", rustc_lexer::UNICODE_VERSION);
}
1 change: 1 addition & 0 deletions tests/ui-fulldeps/lexer/unicode-version.run.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unicode version is: (16, 0, 0)
4 changes: 4 additions & 0 deletions triagebot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,10 @@ cc = ["@Zalathar"]
[mentions."src/tools/opt-dist"]
cc = ["@kobzol"]

[mentions."tests/ui-fulldeps/lexer/unicode-version.run.stdout"]
message = "Unicode version has changed."
cc = ["@ehuss"]

[assign]
warn_non_default_branch = true
contributing_url = "https://rustc-dev-guide.rust-lang.org/getting-started.html"
Expand Down

0 comments on commit 35ac908

Please sign in to comment.