Move Utf8Lossy decoder to libcore

This commit is contained in:
Simon Sapin 2018-04-05 15:55:28 +02:00
parent ae6adf335c
commit f87d4a15a8
12 changed files with 16 additions and 31 deletions

View File

@ -63,7 +63,7 @@ use core::ops::Bound::{Excluded, Included, Unbounded};
use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
use core::ptr;
use core::str::pattern::Pattern;
use std_unicode::lossy;
use core::str::lossy;
use std_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
use borrow::{Cow, ToOwned};

View File

@ -8,12 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core::str as core_str;
use core::fmt;
use core::fmt::Write;
use char;
use core::mem;
use str as core_str;
use fmt;
use fmt::Write;
use mem;
/// Lossy UTF-8 string.
#[unstable(feature = "str_internals", issue = "0")]

View File

@ -26,6 +26,10 @@ use mem;
pub mod pattern;
#[unstable(feature = "str_internals", issue = "0")]
#[allow(missing_docs)]
pub mod lossy;
/// A trait to abstract the idea of creating a new instance of a type from a
/// string.
///

View File

@ -33,6 +33,7 @@
#![feature(sort_internals)]
#![feature(specialization)]
#![feature(step_trait)]
#![feature(str_internals)]
#![feature(test)]
#![feature(trusted_len)]
#![feature(try_trait)]
@ -68,4 +69,5 @@ mod ptr;
mod result;
mod slice;
mod str;
mod str_lossy;
mod tuple;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std_unicode::lossy::*;
use core::str::lossy::*;
#[test]
fn chunks() {

View File

@ -19,7 +19,7 @@ use rc::Rc;
use sync::Arc;
use sys_common::{AsInner, IntoInner};
use sys_common::bytestring::debug_fmt_bytestring;
use std_unicode::lossy::Utf8Lossy;
use core::str::lossy::Utf8Lossy;
#[derive(Clone, Hash)]
pub struct Buf {

View File

@ -19,7 +19,7 @@ use rc::Rc;
use sync::Arc;
use sys_common::{AsInner, IntoInner};
use sys_common::bytestring::debug_fmt_bytestring;
use std_unicode::lossy::Utf8Lossy;
use core::str::lossy::Utf8Lossy;
#[derive(Clone, Hash)]
pub struct Buf {

View File

@ -19,7 +19,7 @@ use rc::Rc;
use sync::Arc;
use sys_common::{AsInner, IntoInner};
use sys_common::bytestring::debug_fmt_bytestring;
use std_unicode::lossy::Utf8Lossy;
use core::str::lossy::Utf8Lossy;
#[derive(Clone, Hash)]
pub struct Buf {

View File

@ -11,7 +11,7 @@
#![allow(dead_code)]
use fmt::{Formatter, Result, Write};
use std_unicode::lossy::{Utf8Lossy, Utf8LossyChunk};
use core::str::lossy::{Utf8Lossy, Utf8LossyChunk};
pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result {
// Writes out a valid unicode string with the correct escape sequences

View File

@ -9,10 +9,6 @@ path = "lib.rs"
test = false
bench = false
[[test]]
name = "std_unicode_tests"
path = "tests/lib.rs"
[dependencies]
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -45,7 +45,6 @@ mod tables;
mod u_str;
mod version;
pub mod char;
pub mod lossy;
#[allow(deprecated)]
pub mod str {

View File

@ -1,15 +0,0 @@
// Copyright 2012-2017 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.
#![feature(str_internals, unicode)]
extern crate std_unicode;
mod lossy;