1//! Unified crate for re-exporting Unicode crates for the compiler.
2//! Used to avoid having multiple different Unicode versions in use.
34// If this changes, update https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md.
5// At time of writing, updating this requires a T-lang FCP.
6const UNICODE_VERSION: (u8, u8, u8) = (18, 0, 0);
78const _: () = {
9let (major, minor, patch) = UNICODE_VERSION;
10let (major_, minor_, patch_) = char::UNICODE_VERSION;
11if major != major_ || minor != minor_ || patch != patch_ {
12// For now, upgrades for the Unicode version used by core and the compiler are independent.
13 // Until this changes, the Unicode version in this crate and `char` may diverge by
14 // 1 major version.
15 // Update this const to make this explicit.
16const VERSIONS_DIFFER: bool = false;
17if !VERSIONS_DIFFER || major + 1 != major_ {
18{
::core::panicking::panic_fmt(format_args!("rustc_unicode::UNICODE_VERSION does not match char::UNICODE_VERSION"));
}panic!("rustc_unicode::UNICODE_VERSION does not match char::UNICODE_VERSION",)19 }
20 }
21};
2223macro_rules!reexport_and_check {
24 ($($krate:ident),+ $(,)?) => {
25 $(
26pub use $krate;
27const _: () = {
28let (major, minor, patch) = UNICODE_VERSION;
29let (major_, minor_, patch_) = $krate::UNICODE_VERSION;
30if (
31 major as u64 != major_ as u64 ||
32 minor as u64 != minor_ as u64 ||
33 patch as u64 != patch_ as u64
34 ) {
35panic!(
36concat!(
37stringify!($krate),
38" does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"
39)
40 )
41 }
42 };
43 )+
44 }
45}
4647pub use unicode_ident;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_ident::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_ident does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};
pub use unicode_normalization;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_normalization::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_normalization does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};
pub use unicode_properties;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_properties::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_properties does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};
pub use unicode_script;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_script::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_script does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};
pub use unicode_security;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_security::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_security does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};
pub use unicode_width;
const _: () =
{
let (major, minor, patch) = UNICODE_VERSION;
let (major_, minor_, patch_) = unicode_width::UNICODE_VERSION;
if (major as u64 != major_ as u64 || minor as u64 != minor_ as u64 ||
patch as u64 != patch_ as u64) {
{
::core::panicking::panic_fmt(format_args!("unicode_width does not have the correct Unicode version (`rustc_unicode::UNICODE_VERSION`)"));
}
}
};reexport_and_check!(
48// tidy-alphabetical-start
49unicode_ident,
50 unicode_normalization,
51 unicode_properties,
52 unicode_script,
53 unicode_security,
54 unicode_width,
55// tidy-alphabetical-end
56);