mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-12 18:07:40 +00:00
Auto merge of #42998 - behnam:uni-ver-type, r=sfackler
[libstd_unicode] Change UNICODE_VERSION to use u32 Looks like there's no strong reason to keep these values at `u64`. With the current plans for the Unicode Standard, `u8` should be enough for the next 200 years. To stay on the safe side, I'm using `u16` here. I don't see a reason to go with anything machine-dependent/more-efficient.
This commit is contained in:
commit
d69cdca153
@ -12,9 +12,32 @@
|
|||||||
|
|
||||||
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
|
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
|
||||||
|
|
||||||
/// The version of [Unicode](http://www.unicode.org/)
|
/// Represents a Unicode Version.
|
||||||
/// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on.
|
///
|
||||||
pub const UNICODE_VERSION: (u64, u64, u64) = (10, 0, 0);
|
/// See also: <http://www.unicode.org/versions/>
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||||
|
pub struct UnicodeVersion {
|
||||||
|
/// Major version.
|
||||||
|
pub major: u32,
|
||||||
|
|
||||||
|
/// Minor version.
|
||||||
|
pub minor: u32,
|
||||||
|
|
||||||
|
/// Micro (or Update) version.
|
||||||
|
pub micro: u32,
|
||||||
|
|
||||||
|
// Private field to keep struct expandable.
|
||||||
|
_priv: (),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
|
||||||
|
/// `CharExt` and `UnicodeStrPrelude` traits are based on.
|
||||||
|
pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
|
||||||
|
major: 10,
|
||||||
|
minor: 0,
|
||||||
|
micro: 0,
|
||||||
|
_priv: (),
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// BoolTrie is a trie for representing a set of Unicode codepoints. It is
|
// BoolTrie is a trie for representing a set of Unicode codepoints. It is
|
||||||
|
@ -560,9 +560,32 @@ if __name__ == "__main__":
|
|||||||
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
|
pattern = "for Version (\d+)\.(\d+)\.(\d+) of the Unicode"
|
||||||
unicode_version = re.search(pattern, readme.read()).groups()
|
unicode_version = re.search(pattern, readme.read()).groups()
|
||||||
rf.write("""
|
rf.write("""
|
||||||
/// The version of [Unicode](http://www.unicode.org/)
|
/// Represents a Unicode Version.
|
||||||
/// that the unicode parts of `CharExt` and `UnicodeStrPrelude` traits are based on.
|
///
|
||||||
pub const UNICODE_VERSION: (u64, u64, u64) = (%s, %s, %s);
|
/// See also: <http://www.unicode.org/versions/>
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||||
|
pub struct UnicodeVersion {
|
||||||
|
/// Major version.
|
||||||
|
pub major: u32,
|
||||||
|
|
||||||
|
/// Minor version.
|
||||||
|
pub minor: u32,
|
||||||
|
|
||||||
|
/// Micro (or Update) version.
|
||||||
|
pub micro: u32,
|
||||||
|
|
||||||
|
// Private field to keep struct expandable.
|
||||||
|
_priv: (),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
|
||||||
|
/// `CharExt` and `UnicodeStrPrelude` traits are based on.
|
||||||
|
pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
|
||||||
|
major: %s,
|
||||||
|
minor: %s,
|
||||||
|
micro: %s,
|
||||||
|
_priv: (),
|
||||||
|
};
|
||||||
""" % unicode_version)
|
""" % unicode_version)
|
||||||
(canon_decomp, compat_decomp, gencats, combines,
|
(canon_decomp, compat_decomp, gencats, combines,
|
||||||
to_upper, to_lower, to_title) = load_unicode_data("UnicodeData.txt")
|
to_upper, to_lower, to_title) = load_unicode_data("UnicodeData.txt")
|
||||||
|
Loading…
Reference in New Issue
Block a user