summary refs log tree commit diff
path: root/src/libcollections/string.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2014-08-06 20:03:55 -0700
committerBrian Anderson <banderson@mozilla.com>2014-08-13 11:30:14 -0700
commitfbc93082ec92c3534c4b27fef35d78d97bd77fd2 (patch)
treed5154fe0a4a461ce65f1dff659ac9117fb310e8d /src/libcollections/string.rs
parent4f5b6927e8e428239082ecc17b85a0506bcc9a65 (diff)
downloadrust-fbc93082ec92c3534c4b27fef35d78d97bd77fd2.tar.gz
rust-fbc93082ec92c3534c4b27fef35d78d97bd77fd2.zip
std: Rename slice::Vector to Slice
This required some contortions because importing both raw::Slice
and slice::Slice makes rustc crash.

Since `Slice` is in the prelude, this renaming is unlikely to
casue breakage.

[breaking-change]
Diffstat (limited to 'src/libcollections/string.rs')
-rw-r--r--src/libcollections/string.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 952f28da2af..d8cc80fdf41 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -18,12 +18,15 @@ use core::default::Default;
 use core::fmt;
 use core::mem;
 use core::ptr;
-use core::raw::Slice;
+// FIXME: ICE's abound if you import the `Slice` type while importing `Slice` trait
+use RawSlice = core::raw::Slice;
+use core::slice::Slice;
 
 use {Collection, Mutable, MutableSeq};
 use hash;
 use str;
-use str::{CharRange, StrAllocating, MaybeOwned, Owned, Slice};
+use str::{CharRange, StrAllocating, MaybeOwned, Owned};
+use MaybeOwnedSlice = str::Slice; // So many `Slice`s...
 use vec::Vec;
 
 /// A growable string stored as a UTF-8 encoded buffer.
@@ -130,7 +133,7 @@ impl String {
     /// ```
     pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
         if str::is_utf8(v) {
-            return Slice(unsafe { mem::transmute(v) })
+            return MaybeOwnedSlice(unsafe { mem::transmute(v) })
         }
 
         static TAG_CONT_U8: u8 = 128u8;
@@ -496,7 +499,7 @@ impl String {
         unsafe {
             // Attempt to not use an intermediate buffer by just pushing bytes
             // directly onto this string.
-            let slice = Slice {
+            let slice = RawSlice {
                 data: self.vec.as_ptr().offset(cur_len as int),
                 len: 4,
             };