about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-11 17:52:13 +0200
committerGitHub <noreply@github.com>2020-04-11 17:52:13 +0200
commitb794cb262fc3398a1beab4ee3aaeefe80454aa69 (patch)
treecdfafec8af13e265d61dab17070c3075afa3cdb0 /src/libcore
parent03a724bd486da1d2691df3d8709c688a0704f1e0 (diff)
parent7f4048c710249daafacdb6004da312e0681954f5 (diff)
downloadrust-b794cb262fc3398a1beab4ee3aaeefe80454aa69.tar.gz
rust-b794cb262fc3398a1beab4ee3aaeefe80454aa69.zip
Rollup merge of #71020 - pyfisch:unicode-version, r=sfackler
Store UNICODE_VERSION as a tuple

Remove the UnicodeVersion struct containing
major, minor and update fields and replace it with
a 3-tuple containing the version number.
As the value of each field is limited to 255
use u8 to store them.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/char/mod.rs2
-rw-r--r--src/libcore/unicode/mod.rs13
-rw-r--r--src/libcore/unicode/unicode_data.rs2
-rw-r--r--src/libcore/unicode/version.rs18
4 files changed, 5 insertions, 30 deletions
diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs
index cf5576e549c..715ad8992ad 100644
--- a/src/libcore/char/mod.rs
+++ b/src/libcore/char/mod.rs
@@ -37,8 +37,6 @@ pub use self::decode::{decode_utf16, DecodeUtf16, DecodeUtf16Error};
 
 // unstable re-exports
 #[unstable(feature = "unicode_version", issue = "49726")]
-pub use crate::unicode::version::UnicodeVersion;
-#[unstable(feature = "unicode_version", issue = "49726")]
 pub use crate::unicode::UNICODE_VERSION;
 
 use crate::fmt::{self, Write};
diff --git a/src/libcore/unicode/mod.rs b/src/libcore/unicode/mod.rs
index 94a2507e26c..3952ae4482e 100644
--- a/src/libcore/unicode/mod.rs
+++ b/src/libcore/unicode/mod.rs
@@ -3,19 +3,14 @@
 
 pub(crate) mod printable;
 mod unicode_data;
-pub(crate) mod version;
-
-use version::UnicodeVersion;
 
 /// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
 /// `char` and `str` methods are based on.
+///
+/// The version numbering scheme is explained in
+/// [Unicode 11.0 or later, Section 3.1 Versions of the Unicode Standard](https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf#page=4).
 #[unstable(feature = "unicode_version", issue = "49726")]
-pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
-    major: unicode_data::UNICODE_VERSION.0,
-    minor: unicode_data::UNICODE_VERSION.1,
-    micro: unicode_data::UNICODE_VERSION.2,
-    _priv: (),
-};
+pub const UNICODE_VERSION: (u8, u8, u8) = unicode_data::UNICODE_VERSION;
 
 // For use in liballoc, not re-exported in libstd.
 pub mod derived_property {
diff --git a/src/libcore/unicode/unicode_data.rs b/src/libcore/unicode/unicode_data.rs
index 48caa21fb0a..9c92a8ba28a 100644
--- a/src/libcore/unicode/unicode_data.rs
+++ b/src/libcore/unicode/unicode_data.rs
@@ -94,7 +94,7 @@ fn skip_search<const SOR: usize, const OFFSETS: usize>(
     offset_idx % 2 == 1
 }
 
-pub const UNICODE_VERSION: (u32, u32, u32) = (13, 0, 0);
+pub const UNICODE_VERSION: (u8, u8, u8) = (13, 0, 0);
 
 #[rustfmt::skip]
 pub mod alphabetic {
diff --git a/src/libcore/unicode/version.rs b/src/libcore/unicode/version.rs
deleted file mode 100644
index 4d68d2e8c2e..00000000000
--- a/src/libcore/unicode/version.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-/// Represents a Unicode Version.
-///
-/// See also: <http://www.unicode.org/versions/>
-#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
-#[unstable(feature = "unicode_version", issue = "49726")]
-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.
-    pub(crate) _priv: (),
-}