about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-04-05 17:09:28 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-04-12 00:13:43 +0200
commit5807be7ccb2c14df9db87a54038221bbf5ae00fa (patch)
tree9f929cd883f06c42c62d985cad4e06c9b683a066 /src
parentf87d4a15a82a76e7510629173c366d084f2c02ca (diff)
downloadrust-5807be7ccb2c14df9db87a54038221bbf5ae00fa.tar.gz
rust-5807be7ccb2c14df9db87a54038221bbf5ae00fa.zip
Move contents of libstd_unicode into libcore
Diffstat (limited to 'src')
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/unicode/bool_trie.rs (renamed from src/libstd_unicode/bool_trie.rs)0
-rw-r--r--src/libcore/unicode/char.rs (renamed from src/libstd_unicode/char.rs)24
-rw-r--r--src/libcore/unicode/mod.rs29
-rw-r--r--src/libcore/unicode/str.rs (renamed from src/libstd_unicode/u_str.rs)6
-rw-r--r--src/libcore/unicode/tables.rs (renamed from src/libstd_unicode/tables.rs)7
-rwxr-xr-xsrc/libcore/unicode/unicode.py (renamed from src/libstd_unicode/unicode.py)7
-rw-r--r--src/libcore/unicode/version.rs (renamed from src/libstd_unicode/version.rs)0
-rw-r--r--src/libstd_unicode/lib.rs32
-rw-r--r--src/test/compile-fail/single-primitive-inherent-impl.rs8
10 files changed, 56 insertions, 59 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index e194b173aa7..7cb635a299a 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -180,6 +180,8 @@ pub mod hash;
 pub mod fmt;
 pub mod time;
 
+pub mod unicode;
+
 /* Heap memory allocator trait */
 #[allow(missing_docs)]
 pub mod heap;
diff --git a/src/libstd_unicode/bool_trie.rs b/src/libcore/unicode/bool_trie.rs
index 3e45b08f399..3e45b08f399 100644
--- a/src/libstd_unicode/bool_trie.rs
+++ b/src/libcore/unicode/bool_trie.rs
diff --git a/src/libstd_unicode/char.rs b/src/libcore/unicode/char.rs
index 460f83d875a..0e8b09f621a 100644
--- a/src/libstd_unicode/char.rs
+++ b/src/libcore/unicode/char.rs
@@ -28,30 +28,30 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
-use core::char::CharExt as C;
-use core::iter::FusedIterator;
-use core::fmt::{self, Write};
-use tables::{conversions, derived_property, general_category, property};
+use char::CharExt as C;
+use iter::FusedIterator;
+use fmt::{self, Write};
+use unicode::tables::{conversions, derived_property, general_category, property};
 
 // stable re-exports
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked};
+pub use char::{MAX, from_digit, from_u32, from_u32_unchecked};
 #[stable(feature = "rust1", since = "1.0.0")]
-pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode};
+pub use char::{EscapeDebug, EscapeDefault, EscapeUnicode};
 #[stable(feature = "decode_utf16", since = "1.9.0")]
-pub use core::char::REPLACEMENT_CHARACTER;
+pub use char::REPLACEMENT_CHARACTER;
 #[stable(feature = "char_from_str", since = "1.20.0")]
-pub use core::char::ParseCharError;
+pub use char::ParseCharError;
 
 // unstable re-exports
 #[stable(feature = "try_from", since = "1.26.0")]
-pub use core::char::CharTryFromError;
+pub use char::CharTryFromError;
 #[unstable(feature = "decode_utf8", issue = "33906")]
-pub use core::char::{DecodeUtf8, decode_utf8};
+pub use char::{DecodeUtf8, decode_utf8};
 #[unstable(feature = "unicode", issue = "27783")]
-pub use tables::{UNICODE_VERSION};
+pub use unicode::tables::{UNICODE_VERSION};
 #[unstable(feature = "unicode", issue = "27783")]
-pub use version::UnicodeVersion;
+pub use unicode::version::UnicodeVersion;
 
 /// Returns an iterator that yields the lowercase equivalent of a `char`.
 ///
diff --git a/src/libcore/unicode/mod.rs b/src/libcore/unicode/mod.rs
new file mode 100644
index 00000000000..aaf8081799f
--- /dev/null
+++ b/src/libcore/unicode/mod.rs
@@ -0,0 +1,29 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![unstable(feature = "unicode", issue = "27783")]
+#![allow(missing_docs)]
+
+mod bool_trie;
+mod tables;
+mod version;
+
+pub mod str;
+pub mod char;
+
+// For use in liballoc, not re-exported in libstd.
+pub mod derived_property {
+    pub use unicode::tables::derived_property::{Case_Ignorable, Cased};
+}
+
+// For use in libsyntax
+pub mod property {
+    pub use unicode::tables::property::Pattern_White_Space;
+}
diff --git a/src/libstd_unicode/u_str.rs b/src/libcore/unicode/str.rs
index a72e1210d93..18581bf4d58 100644
--- a/src/libstd_unicode/u_str.rs
+++ b/src/libcore/unicode/str.rs
@@ -13,9 +13,9 @@
 //! This module provides functionality to `str` that requires the Unicode
 //! methods provided by the unicode parts of the CharExt trait.
 
-use core::char;
-use core::iter::{Filter, FusedIterator};
-use core::str::Split;
+use char;
+use iter::{Filter, FusedIterator};
+use str::Split;
 
 /// An iterator over the non-whitespace substrings of a string,
 /// separated by any amount of whitespace.
diff --git a/src/libstd_unicode/tables.rs b/src/libcore/unicode/tables.rs
index b53953b62a7..7e8e925bda3 100644
--- a/src/libstd_unicode/tables.rs
+++ b/src/libcore/unicode/tables.rs
@@ -12,8 +12,8 @@
 
 #![allow(missing_docs, non_upper_case_globals, non_snake_case)]
 
-use version::UnicodeVersion;
-use bool_trie::{BoolTrie, SmallBoolTrie};
+use unicode::version::UnicodeVersion;
+use unicode::bool_trie::{BoolTrie, SmallBoolTrie};
 
 /// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
 /// `CharExt` and `UnicodeStrPrelude` traits are based on.
@@ -1138,9 +1138,6 @@ pub mod property {
 }
 
 pub mod conversions {
-    use core::option::Option;
-    use core::option::Option::{Some, None};
-
     pub fn to_lower(c: char) -> [char; 3] {
         match bsearch_case_table(c, to_lowercase_table) {
             None        => [c, '\0', '\0'],
diff --git a/src/libstd_unicode/unicode.py b/src/libcore/unicode/unicode.py
index a8629493086..39b68dc7d9b 100755
--- a/src/libstd_unicode/unicode.py
+++ b/src/libcore/unicode/unicode.py
@@ -39,8 +39,8 @@ preamble = '''// Copyright 2012-2016 The Rust Project Developers. See the COPYRI
 
 #![allow(missing_docs, non_upper_case_globals, non_snake_case)]
 
-use version::UnicodeVersion;
-use bool_trie::{BoolTrie, SmallBoolTrie};
+use unicode::version::UnicodeVersion;
+use unicode::bool_trie::{BoolTrie, SmallBoolTrie};
 '''
 
 # Mapping taken from Table 12 from:
@@ -408,9 +408,6 @@ def emit_property_module(f, mod, tbl, emit):
 def emit_conversions_module(f, to_upper, to_lower, to_title):
     f.write("pub mod conversions {")
     f.write("""
-    use core::option::Option;
-    use core::option::Option::{Some, None};
-
     pub fn to_lower(c: char) -> [char; 3] {
         match bsearch_case_table(c, to_lowercase_table) {
             None        => [c, '\\0', '\\0'],
diff --git a/src/libstd_unicode/version.rs b/src/libcore/unicode/version.rs
index d82a749d917..d82a749d917 100644
--- a/src/libstd_unicode/version.rs
+++ b/src/libcore/unicode/version.rs
diff --git a/src/libstd_unicode/lib.rs b/src/libstd_unicode/lib.rs
index 106a2c0f0c5..8cdeb6c8ad1 100644
--- a/src/libstd_unicode/lib.rs
+++ b/src/libstd_unicode/lib.rs
@@ -27,37 +27,9 @@
        html_playground_url = "https://play.rust-lang.org/",
        issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
        test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
-#![deny(missing_debug_implementations)]
 #![no_std]
 
-#![feature(ascii_ctype)]
-#![feature(core_char_ext)]
-#![feature(str_internals)]
-#![feature(decode_utf8)]
-#![feature(fn_traits)]
-#![feature(lang_items)]
-#![feature(non_exhaustive)]
+#![feature(unicode)]
 #![feature(staged_api)]
-#![feature(unboxed_closures)]
 
-mod bool_trie;
-mod tables;
-mod u_str;
-mod version;
-pub mod char;
-
-#[allow(deprecated)]
-pub mod str {
-    pub use u_str::{SplitWhitespace, UnicodeStr};
-    pub use u_str::Utf16Encoder;
-}
-
-// For use in liballoc, not re-exported in libstd.
-pub mod derived_property {
-    pub use tables::derived_property::{Case_Ignorable, Cased};
-}
-
-// For use in libsyntax
-pub mod property {
-    pub use tables::property::Pattern_White_Space;
-}
+pub use core::unicode::*;
diff --git a/src/test/compile-fail/single-primitive-inherent-impl.rs b/src/test/compile-fail/single-primitive-inherent-impl.rs
index 5ceb870528a..365387c3e5e 100644
--- a/src/test/compile-fail/single-primitive-inherent-impl.rs
+++ b/src/test/compile-fail/single-primitive-inherent-impl.rs
@@ -15,9 +15,9 @@
 #![no_std]
 
 // OK
-#[lang = "char"]
-impl char {}
+#[lang = "str"]
+impl str {}
 
-impl char {
-//~^ error: only a single inherent implementation marked with `#[lang = "char"]` is allowed for the `char` primitive
+impl str {
+//~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive
 }