Skip to content

Commit 9396924

Browse files
committed
Reexport from core::unicode::char in core::char rather than vice versa
1 parent 3613b0b commit 9396924

File tree

6 files changed

+19
-26
lines changed

6 files changed

+19
-26
lines changed

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
5757
#![stable(feature = "rust1", since = "1.0.0")]
5858

59+
use core::char::{decode_utf16, REPLACEMENT_CHARACTER};
5960
use core::fmt;
6061
use core::hash;
6162
use core::iter::{FromIterator, FusedIterator};
@@ -64,7 +65,6 @@ use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
6465
use core::ptr;
6566
use core::str::pattern::Pattern;
6667
use core::str::lossy;
67-
use core::unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
6868

6969
use borrow::{Cow, ToOwned};
7070
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};

src/liballoc/tests/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn test_from_utf16() {
132132
let s_as_utf16 = s.encode_utf16().collect::<Vec<u16>>();
133133
let u_as_string = String::from_utf16(&u).unwrap();
134134

135-
assert!(::core::unicode::char::decode_utf16(u.iter().cloned()).all(|r| r.is_ok()));
135+
assert!(::core::char::decode_utf16(u.iter().cloned()).all(|r| r.is_ok()));
136136
assert_eq!(s_as_utf16, u);
137137

138138
assert_eq!(u_as_string, s);

src/libcore/char/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
#![allow(non_snake_case)]
1616
#![stable(feature = "core_char", since = "1.2.0")]
1717

18+
// stable re-exports
19+
#[stable(feature = "rust1", since = "1.0.0")]
20+
pub use unicode::char::{ToLowercase, ToUppercase};
21+
#[stable(feature = "decode_utf16", since = "1.9.0")]
22+
pub use unicode::char::{decode_utf16, DecodeUtf16, DecodeUtf16Error};
23+
24+
// unstable re-exports
25+
#[unstable(feature = "unicode", issue = "27783")]
26+
pub use unicode::tables::{UNICODE_VERSION};
27+
#[unstable(feature = "unicode", issue = "27783")]
28+
pub use unicode::version::UnicodeVersion;
29+
1830
mod printable;
1931

2032
use self::printable::is_printable;

src/libcore/unicode/char.rs

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

31+
use char::*;
3132
use char::CharExt as C;
3233
use iter::FusedIterator;
3334
use fmt::{self, Write};
3435
use unicode::tables::{conversions, derived_property, general_category, property};
3536

36-
// stable re-exports
37-
#[stable(feature = "rust1", since = "1.0.0")]
38-
pub use char::{MAX, from_digit, from_u32, from_u32_unchecked};
39-
#[stable(feature = "rust1", since = "1.0.0")]
40-
pub use char::{EscapeDebug, EscapeDefault, EscapeUnicode};
41-
#[stable(feature = "decode_utf16", since = "1.9.0")]
42-
pub use char::REPLACEMENT_CHARACTER;
43-
#[stable(feature = "char_from_str", since = "1.20.0")]
44-
pub use char::ParseCharError;
45-
46-
// unstable re-exports
47-
#[stable(feature = "try_from", since = "1.26.0")]
48-
pub use char::CharTryFromError;
49-
#[unstable(feature = "decode_utf8", issue = "33906")]
50-
pub use char::{DecodeUtf8, decode_utf8};
51-
#[unstable(feature = "unicode", issue = "27783")]
52-
pub use unicode::tables::{UNICODE_VERSION};
53-
#[unstable(feature = "unicode", issue = "27783")]
54-
pub use unicode::version::UnicodeVersion;
55-
5637
/// Returns an iterator that yields the lowercase equivalent of a `char`.
5738
///
5839
/// This `struct` is created by the [`to_lowercase`] method on [`char`]. See

src/libcore/unicode/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
#![allow(missing_docs)]
1313

1414
mod bool_trie;
15-
mod tables;
16-
mod version;
15+
pub(crate) mod tables;
16+
pub(crate) mod version;
1717

1818
pub mod str;
19-
pub mod char;
19+
pub(crate) mod char;
2020

2121
// For use in liballoc, not re-exported in libstd.
2222
pub mod derived_property {

src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ pub use alloc::string;
454454
#[stable(feature = "rust1", since = "1.0.0")]
455455
pub use alloc::vec;
456456
#[stable(feature = "rust1", since = "1.0.0")]
457-
pub use core::unicode::char;
457+
pub use core::char;
458458
#[stable(feature = "i128", since = "1.26.0")]
459459
pub use core::u128;
460460

0 commit comments

Comments
 (0)