Skip to content

Commit f87d4a1

Browse files
committed
Move Utf8Lossy decoder to libcore
1 parent ae6adf3 commit f87d4a1

File tree

12 files changed

+16
-31
lines changed

12 files changed

+16
-31
lines changed

src/liballoc/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use core::ops::Bound::{Excluded, Included, Unbounded};
6363
use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
6464
use core::ptr;
6565
use core::str::pattern::Pattern;
66-
use std_unicode::lossy;
66+
use core::str::lossy;
6767
use std_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
6868

6969
use borrow::{Cow, ToOwned};

src/libstd_unicode/lossy.rs renamed to src/libcore/str/lossy.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use core::str as core_str;
12-
use core::fmt;
13-
use core::fmt::Write;
1411
use char;
15-
use core::mem;
16-
12+
use str as core_str;
13+
use fmt;
14+
use fmt::Write;
15+
use mem;
1716

1817
/// Lossy UTF-8 string.
1918
#[unstable(feature = "str_internals", issue = "0")]

src/libcore/str/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ use mem;
2626

2727
pub mod pattern;
2828

29+
#[unstable(feature = "str_internals", issue = "0")]
30+
#[allow(missing_docs)]
31+
pub mod lossy;
32+
2933
/// A trait to abstract the idea of creating a new instance of a type from a
3034
/// string.
3135
///

src/libcore/tests/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#![feature(sort_internals)]
3434
#![feature(specialization)]
3535
#![feature(step_trait)]
36+
#![feature(str_internals)]
3637
#![feature(test)]
3738
#![feature(trusted_len)]
3839
#![feature(try_trait)]
@@ -68,4 +69,5 @@ mod ptr;
6869
mod result;
6970
mod slice;
7071
mod str;
72+
mod str_lossy;
7173
mod tuple;

src/libstd_unicode/tests/lossy.rs renamed to src/libcore/tests/str_lossy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std_unicode::lossy::*;
11+
use core::str::lossy::*;
1212

1313
#[test]
1414
fn chunks() {

src/libstd/sys/redox/os_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rc::Rc;
1919
use sync::Arc;
2020
use sys_common::{AsInner, IntoInner};
2121
use sys_common::bytestring::debug_fmt_bytestring;
22-
use std_unicode::lossy::Utf8Lossy;
22+
use core::str::lossy::Utf8Lossy;
2323

2424
#[derive(Clone, Hash)]
2525
pub struct Buf {

src/libstd/sys/unix/os_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rc::Rc;
1919
use sync::Arc;
2020
use sys_common::{AsInner, IntoInner};
2121
use sys_common::bytestring::debug_fmt_bytestring;
22-
use std_unicode::lossy::Utf8Lossy;
22+
use core::str::lossy::Utf8Lossy;
2323

2424
#[derive(Clone, Hash)]
2525
pub struct Buf {

src/libstd/sys/wasm/os_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use rc::Rc;
1919
use sync::Arc;
2020
use sys_common::{AsInner, IntoInner};
2121
use sys_common::bytestring::debug_fmt_bytestring;
22-
use std_unicode::lossy::Utf8Lossy;
22+
use core::str::lossy::Utf8Lossy;
2323

2424
#[derive(Clone, Hash)]
2525
pub struct Buf {

src/libstd/sys_common/bytestring.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(dead_code)]
1212

1313
use fmt::{Formatter, Result, Write};
14-
use std_unicode::lossy::{Utf8Lossy, Utf8LossyChunk};
14+
use core::str::lossy::{Utf8Lossy, Utf8LossyChunk};
1515

1616
pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result {
1717
// Writes out a valid unicode string with the correct escape sequences

src/libstd_unicode/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ path = "lib.rs"
99
test = false
1010
bench = false
1111

12-
[[test]]
13-
name = "std_unicode_tests"
14-
path = "tests/lib.rs"
15-
1612
[dependencies]
1713
core = { path = "../libcore" }
1814
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

0 commit comments

Comments
 (0)