diff --git a/compiler/rustc_lexer/src/lib.rs b/compiler/rustc_lexer/src/lib.rs index 6caeec1b5cc90..aa4abf678b9f2 100644 --- a/compiler/rustc_lexer/src/lib.rs +++ b/compiler/rustc_lexer/src/lib.rs @@ -33,6 +33,7 @@ pub mod unescape; mod tests; use unicode_properties::UnicodeEmoji; +pub use unicode_xid::UNICODE_VERSION as UNICODE_XID_VERSION; use self::LiteralKind::*; use self::TokenKind::*; diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 2792050a0b39d..f963a424a7fd6 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -24,6 +24,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{Diag, FatalError, PResult}; use rustc_session::parse::ParseSess; use rustc_span::{FileName, SourceFile, Span}; +pub use unicode_normalization::UNICODE_VERSION as UNICODE_NORMALIZATION_VERSION; pub const MACRO_ARGUMENTS: Option<&str> = Some("macro arguments"); diff --git a/tests/ui-fulldeps/lexer/unicode-version.rs b/tests/ui-fulldeps/lexer/unicode-version.rs new file mode 100644 index 0000000000000..3cb1f1a785837 --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.rs @@ -0,0 +1,21 @@ +// 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 +//@ reference: ident.normalization + +#![feature(rustc_private)] + +extern crate rustc_driver; +extern crate rustc_lexer; +extern crate rustc_parse; + +fn main() { + println!("Unicode XID version is: {:?}", rustc_lexer::UNICODE_XID_VERSION); + println!("Unicode normalization version is: {:?}", rustc_parse::UNICODE_NORMALIZATION_VERSION); +} diff --git a/tests/ui-fulldeps/lexer/unicode-version.run.stdout b/tests/ui-fulldeps/lexer/unicode-version.run.stdout new file mode 100644 index 0000000000000..9b0f419eacfae --- /dev/null +++ b/tests/ui-fulldeps/lexer/unicode-version.run.stdout @@ -0,0 +1,2 @@ +Unicode XID version is: (16, 0, 0) +Unicode normalization version is: (16, 0, 0) diff --git a/triagebot.toml b/triagebot.toml index 4d6806711fbc8..a9b5649efbb6f 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -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"