diff options
| author | Ivan Petkov <ivanppetkov@gmail.com> | 2015-02-28 23:24:05 -0800 |
|---|---|---|
| committer | Ivan Petkov <ivanppetkov@gmail.com> | 2015-03-02 15:35:48 -0800 |
| commit | 2b03718618d66e7e672663230be1ee857d3fb89a (patch) | |
| tree | a038f2dabb79bf8248a85f6c607b5e83c23f2a99 /src/libstd | |
| parent | 2ca6eaedae9ec4bff2a63f81f473aba653e46ac5 (diff) | |
| download | rust-2b03718618d66e7e672663230be1ee857d3fb89a.tar.gz rust-2b03718618d66e7e672663230be1ee857d3fb89a.zip | |
Enable recursion for visit_ty in lint visitor
* The lint visitor's visit_ty method did not recurse, and had a reference to the now closed #10894 * The newly enabled recursion has only affected the `deprectated` lint which now detects uses of deprecated items in trait impls and function return types * Renamed some references to `CowString` and `CowVec` to `Cow<str>` and `Cow<[T]>`, respectively, which appear outside of the crate which defines them * Replaced a few instances of `InvariantType<T>` with `PhantomData<Cell<T>>` * Disabled the `deprecated` lint in several places that reference/implement traits on deprecated items which will get cleaned up in the future * Disabled the `exceeding_bitshifts` lint for compile-fail/huge-array-simple test so it doesn't shadow the expected error on 32bit systems * Unfortunately, this means that if a library declares `#![deny(deprecated)]` and marks anything as deprecated, it will have to disable the lint for any uses of said item, e.g. any impl the now deprecated item For any library that denies deprecated items but has deprecated items of its own, this is a [breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 7 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os_str.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os_str.rs | 5 | ||||
| -rw-r--r-- | src/libstd/thread_local/scoped.rs | 5 |
5 files changed, 16 insertions, 14 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index fe0df1728ef..926d8e03f2c 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -34,10 +34,10 @@ use core::prelude::*; -use borrow::{Borrow, ToOwned}; +use borrow::{Borrow, Cow, ToOwned}; use fmt::{self, Debug}; use mem; -use string::{String, CowString}; +use string::String; use ops; use cmp; use hash::{Hash, Hasher}; @@ -183,10 +183,10 @@ impl OsStr { self.inner.to_str() } - /// Convert an `OsStr` to a `CowString`. + /// Convert an `OsStr` to a `Cow<str>`. /// /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER. - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { self.inner.to_string_lossy() } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index fb9d6fef1fa..bea2b6c6b40 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -38,7 +38,7 @@ use num::Int; use ops; use slice; use str; -use string::{String, CowString}; +use string::String; use sys_common::AsInner; use unicode::str::{Utf16Item, utf16_items}; use vec::Vec; @@ -530,7 +530,7 @@ impl Wtf8 { /// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “�”). /// /// This only copies the data if necessary (if it contains any surrogate). - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { let surrogate_pos = match self.next_surrogate(0) { None => return Cow::Borrowed(unsafe { str::from_utf8_unchecked(&self.bytes) }), Some((pos, _)) => pos, @@ -844,7 +844,6 @@ mod tests { use borrow::Cow; use super::*; use mem::transmute; - use string::CowString; #[test] fn code_point_from_u32() { @@ -1224,7 +1223,7 @@ mod tests { assert_eq!(Wtf8::from_str("aé 💩").to_string_lossy(), Cow::Borrowed("aé 💩")); let mut string = Wtf8Buf::from_str("aé 💩"); string.push(CodePoint::from_u32(0xD800).unwrap()); - let expected: CowString = Cow::Owned(String::from_str("aé 💩�")); + let expected: Cow<str> = Cow::Owned(String::from_str("aé 💩�")); assert_eq!(string.to_string_lossy(), expected); } diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 023d951dc4f..c8ac524876b 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -13,11 +13,12 @@ use core::prelude::*; +use borrow::Cow; use fmt::{self, Debug}; use vec::Vec; use slice::SliceExt as StdSliceExt; use str; -use string::{String, CowString}; +use string::String; use mem; #[derive(Clone, Hash)] @@ -76,7 +77,7 @@ impl Slice { str::from_utf8(&self.inner).ok() } - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { String::from_utf8_lossy(&self.inner) } diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index af94b56bf1f..ad1e6c4b0e7 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -11,9 +11,10 @@ /// The underlying OsString/OsStr implementation on Windows is a /// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. +use borrow::Cow; use fmt::{self, Debug}; use sys_common::wtf8::{Wtf8, Wtf8Buf}; -use string::{String, CowString}; +use string::String; use result::Result; use option::Option; use mem; @@ -70,7 +71,7 @@ impl Slice { self.inner.as_str() } - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { self.inner.to_string_lossy() } diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index a2a5d8b81f4..d89d69e9497 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -119,7 +119,7 @@ macro_rules! __scoped_thread_local_inner { const _INIT: __Key<$t> = __Key { inner: ::std::thread_local::scoped::__impl::KeyInner { inner: ::std::thread_local::scoped::__impl::OS_INIT, - marker: ::std::marker::InvariantType, + marker: ::std::marker::PhantomData::<::std::cell::Cell<$t>>, } }; @@ -244,12 +244,13 @@ mod imp { target_arch = "aarch64"))] mod imp { use marker; + use std::cell::Cell; use sys_common::thread_local::StaticKey as OsStaticKey; #[doc(hidden)] pub struct KeyInner<T> { pub inner: OsStaticKey, - pub marker: marker::InvariantType<T>, + pub marker: marker::PhantomData<Cell<T>>, } unsafe impl<T> ::marker::Sync for KeyInner<T> { } |
