Skip to content

Commit 5807be7

Browse files
committed
Move contents of libstd_unicode into libcore
1 parent f87d4a1 commit 5807be7

File tree

10 files changed

+56
-59
lines changed

10 files changed

+56
-59
lines changed

src/libcore/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ pub mod hash;
180180
pub mod fmt;
181181
pub mod time;
182182

183+
pub mod unicode;
184+
183185
/* Heap memory allocator trait */
184186
#[allow(missing_docs)]
185187
pub mod heap;
File renamed without changes.

src/libstd_unicode/char.rs renamed to src/libcore/unicode/char.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,30 +28,30 @@
2828
2929
#![stable(feature = "rust1", since = "1.0.0")]
3030

31-
use core::char::CharExt as C;
32-
use core::iter::FusedIterator;
33-
use core::fmt::{self, Write};
34-
use tables::{conversions, derived_property, general_category, property};
31+
use char::CharExt as C;
32+
use iter::FusedIterator;
33+
use fmt::{self, Write};
34+
use unicode::tables::{conversions, derived_property, general_category, property};
3535

3636
// stable re-exports
3737
#[stable(feature = "rust1", since = "1.0.0")]
38-
pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked};
38+
pub use char::{MAX, from_digit, from_u32, from_u32_unchecked};
3939
#[stable(feature = "rust1", since = "1.0.0")]
40-
pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode};
40+
pub use char::{EscapeDebug, EscapeDefault, EscapeUnicode};
4141
#[stable(feature = "decode_utf16", since = "1.9.0")]
42-
pub use core::char::REPLACEMENT_CHARACTER;
42+
pub use char::REPLACEMENT_CHARACTER;
4343
#[stable(feature = "char_from_str", since = "1.20.0")]
44-
pub use core::char::ParseCharError;
44+
pub use char::ParseCharError;
4545

4646
// unstable re-exports
4747
#[stable(feature = "try_from", since = "1.26.0")]
48-
pub use core::char::CharTryFromError;
48+
pub use char::CharTryFromError;
4949
#[unstable(feature = "decode_utf8", issue = "33906")]
50-
pub use core::char::{DecodeUtf8, decode_utf8};
50+
pub use char::{DecodeUtf8, decode_utf8};
5151
#[unstable(feature = "unicode", issue = "27783")]
52-
pub use tables::{UNICODE_VERSION};
52+
pub use unicode::tables::{UNICODE_VERSION};
5353
#[unstable(feature = "unicode", issue = "27783")]
54-
pub use version::UnicodeVersion;
54+
pub use unicode::version::UnicodeVersion;
5555

5656
/// Returns an iterator that yields the lowercase equivalent of a `char`.
5757
///

src/libcore/unicode/mod.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![unstable(feature = "unicode", issue = "27783")]
12+
#![allow(missing_docs)]
13+
14+
mod bool_trie;
15+
mod tables;
16+
mod version;
17+
18+
pub mod str;
19+
pub mod char;
20+
21+
// For use in liballoc, not re-exported in libstd.
22+
pub mod derived_property {
23+
pub use unicode::tables::derived_property::{Case_Ignorable, Cased};
24+
}
25+
26+
// For use in libsyntax
27+
pub mod property {
28+
pub use unicode::tables::property::Pattern_White_Space;
29+
}

src/libstd_unicode/u_str.rs renamed to src/libcore/unicode/str.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
//! This module provides functionality to `str` that requires the Unicode
1414
//! methods provided by the unicode parts of the CharExt trait.
1515
16-
use core::char;
17-
use core::iter::{Filter, FusedIterator};
18-
use core::str::Split;
16+
use char;
17+
use iter::{Filter, FusedIterator};
18+
use str::Split;
1919

2020
/// An iterator over the non-whitespace substrings of a string,
2121
/// separated by any amount of whitespace.

src/libstd_unicode/tables.rs renamed to src/libcore/unicode/tables.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
1414

15-
use version::UnicodeVersion;
16-
use bool_trie::{BoolTrie, SmallBoolTrie};
15+
use unicode::version::UnicodeVersion;
16+
use unicode::bool_trie::{BoolTrie, SmallBoolTrie};
1717

1818
/// The version of [Unicode](http://www.unicode.org/) that the Unicode parts of
1919
/// `CharExt` and `UnicodeStrPrelude` traits are based on.
@@ -1138,9 +1138,6 @@ pub mod property {
11381138
}
11391139

11401140
pub mod conversions {
1141-
use core::option::Option;
1142-
use core::option::Option::{Some, None};
1143-
11441141
pub fn to_lower(c: char) -> [char; 3] {
11451142
match bsearch_case_table(c, to_lowercase_table) {
11461143
None => [c, '\0', '\0'],

src/libstd_unicode/unicode.py renamed to src/libcore/unicode/unicode.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
4040
#![allow(missing_docs, non_upper_case_globals, non_snake_case)]
4141
42-
use version::UnicodeVersion;
43-
use bool_trie::{BoolTrie, SmallBoolTrie};
42+
use unicode::version::UnicodeVersion;
43+
use unicode::bool_trie::{BoolTrie, SmallBoolTrie};
4444
'''
4545

4646
# Mapping taken from Table 12 from:
@@ -408,9 +408,6 @@ def emit_property_module(f, mod, tbl, emit):
408408
def emit_conversions_module(f, to_upper, to_lower, to_title):
409409
f.write("pub mod conversions {")
410410
f.write("""
411-
use core::option::Option;
412-
use core::option::Option::{Some, None};
413-
414411
pub fn to_lower(c: char) -> [char; 3] {
415412
match bsearch_case_table(c, to_lowercase_table) {
416413
None => [c, '\\0', '\\0'],
File renamed without changes.

src/libstd_unicode/lib.rs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,9 @@
2727
html_playground_url = "https://play.rust-lang.org/",
2828
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
2929
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
30-
#![deny(missing_debug_implementations)]
3130
#![no_std]
3231

33-
#![feature(ascii_ctype)]
34-
#![feature(core_char_ext)]
35-
#![feature(str_internals)]
36-
#![feature(decode_utf8)]
37-
#![feature(fn_traits)]
38-
#![feature(lang_items)]
39-
#![feature(non_exhaustive)]
32+
#![feature(unicode)]
4033
#![feature(staged_api)]
41-
#![feature(unboxed_closures)]
4234

43-
mod bool_trie;
44-
mod tables;
45-
mod u_str;
46-
mod version;
47-
pub mod char;
48-
49-
#[allow(deprecated)]
50-
pub mod str {
51-
pub use u_str::{SplitWhitespace, UnicodeStr};
52-
pub use u_str::Utf16Encoder;
53-
}
54-
55-
// For use in liballoc, not re-exported in libstd.
56-
pub mod derived_property {
57-
pub use tables::derived_property::{Case_Ignorable, Cased};
58-
}
59-
60-
// For use in libsyntax
61-
pub mod property {
62-
pub use tables::property::Pattern_White_Space;
63-
}
35+
pub use core::unicode::*;

src/test/compile-fail/single-primitive-inherent-impl.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#![no_std]
1616

1717
// OK
18-
#[lang = "char"]
19-
impl char {}
18+
#[lang = "str"]
19+
impl str {}
2020

21-
impl char {
22-
//~^ error: only a single inherent implementation marked with `#[lang = "char"]` is allowed for the `char` primitive
21+
impl str {
22+
//~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive
2323
}

0 commit comments

Comments
 (0)