diff options
| author | bors <bors@rust-lang.org> | 2014-09-22 05:30:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-09-22 05:30:30 +0000 |
| commit | cbb07e81be99271f9e240a27dcf540686d8c0bfc (patch) | |
| tree | a0a2ce0e5d9e65137f445201cbcd01324ca0d275 /src/libstd/path | |
| parent | 4e5b62618cb5341139177c1ef62e2467affd041f (diff) | |
| parent | 0169218047dc989acf9ea25e3122b9c659acb6b3 (diff) | |
| download | rust-cbb07e81be99271f9e240a27dcf540686d8c0bfc.tar.gz rust-cbb07e81be99271f9e240a27dcf540686d8c0bfc.zip | |
auto merge of #17029 : alexcrichton/rust/vec-stable, r=aturon
The following methods, types, and names have become stable: * Vec * Vec::as_mut_slice * Vec::as_slice * Vec::capacity * Vec::clear * Vec::default * Vec::grow * Vec::insert * Vec::len * Vec::new * Vec::pop * Vec::push * Vec::remove * Vec::set_len * Vec::shrink_to_fit * Vec::truncate * Vec::with_capacity * vec::raw * vec::raw::from_buf * vec::raw::from_raw_parts The following have become unstable: * Vec::dedup // naming * Vec::from_fn // naming and unboxed closures * Vec::get_mut // will be removed for IndexMut * Vec::grow_fn // unboxed closures and naming * Vec::retain // unboxed closures * Vec::swap_remove // uncertain naming * Vec::from_elem // uncertain semantics * vec::unzip // should be generic for all collections The following have been deprecated * Vec::append - call .extend() * Vec::append_one - call .push() * Vec::from_slice - call .to_vec() * Vec::grow_set - call .grow() and then .push() * Vec::into_vec - move the vector instead * Vec::move_iter - renamed to iter_move() * Vec::push_all - call .extend() * Vec::to_vec - call .clone() * Vec:from_raw_parts - moved to raw::from_raw_parts This is a breaking change in terms of the signature of the `Vec::grow` function. The argument used to be taken by reference, but it is now taken by value. Code must update by removing a leading `&` sigil or by calling `.clone()` to create a value. [breaking-change]
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 6 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 22 |
3 files changed, 18 insertions, 16 deletions
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index d84848545bd..16552daae36 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -76,7 +76,7 @@ use option::{Option, None, Some}; use str; use str::{MaybeOwned, Str, StrSlice}; use string::String; -use slice::Slice; +use slice::{Slice, CloneableVector}; use slice::{ImmutablePartialEqSlice, ImmutableSlice}; use vec::Vec; @@ -480,7 +480,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { let extlen = extension.container_as_bytes().len(); match (name.rposition_elem(&dot), extlen) { (None, 0) | (Some(0), 0) => None, - (Some(idx), 0) => Some(Vec::from_slice(name.slice_to(idx))), + (Some(idx), 0) => Some(name.slice_to(idx).to_vec()), (idx, extlen) => { let idx = match idx { None | Some(0) => name.len(), @@ -798,7 +798,7 @@ pub trait BytesContainer { /// Consumes the receiver and converts it into Vec<u8> #[inline] fn container_into_owned_bytes(self) -> Vec<u8> { - Vec::from_slice(self.container_as_bytes()) + self.container_as_bytes().to_vec() } /// Returns the receiver interpreted as a utf-8 string, if possible #[inline] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index c654d3a668a..9c4139853c5 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -264,7 +264,7 @@ impl GenericPath for Path { #[inline] fn is_absolute(&self) -> bool { - *self.repr.get(0) == SEP_BYTE + self.repr[0] == SEP_BYTE } fn is_ancestor_of(&self, other: &Path) -> bool { @@ -399,7 +399,7 @@ impl Path { } }; match val { - None => Vec::from_slice(v.as_slice()), + None => v.as_slice().to_vec(), Some(val) => val } } @@ -409,7 +409,7 @@ impl Path { /// /a/b/c and a/b/c yield the same set of components. /// A path of "/" yields no components. A path of "." yields one component. pub fn components<'a>(&'a self) -> Components<'a> { - let v = if *self.repr.get(0) == SEP_BYTE { + let v = if self.repr[0] == SEP_BYTE { self.repr.slice_from(1) } else { self.repr.as_slice() }; let mut ret = v.split(is_sep_byte); diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index e68c8bdb07d..3f598e52806 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -264,10 +264,10 @@ impl GenericPathUnsafe for Path { let repr = me.repr.as_slice(); match me.prefix { Some(DiskPrefix) => { - repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_upper().to_byte() + repr.as_bytes()[0] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte() } Some(VerbatimDiskPrefix) => { - repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_upper().to_byte() + repr.as_bytes()[4] == path.as_bytes()[0].to_ascii().to_uppercase().to_byte() } _ => false } @@ -371,7 +371,7 @@ impl GenericPath for Path { #[inline] fn into_vec(self) -> Vec<u8> { - Vec::from_slice(self.repr.as_bytes()) + self.repr.into_bytes() } #[inline] @@ -776,9 +776,9 @@ impl Path { let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); - *v.get_mut(0) = v.get(0) + *v.get_mut(0) = (*v)[0] .to_ascii() - .to_upper() + .to_uppercase() .to_byte(); } if is_abs { @@ -794,7 +794,7 @@ impl Path { let mut s = String::from_str(s.slice_to(len)); unsafe { let v = s.as_mut_vec(); - *v.get_mut(4) = v.get(4).to_ascii().to_upper().to_byte(); + *v.get_mut(4) = (*v)[4].to_ascii().to_uppercase().to_byte(); } Some(s) } @@ -815,12 +815,14 @@ impl Path { let mut s = String::with_capacity(n); match prefix { Some(DiskPrefix) => { - s.push_char(prefix_.as_bytes()[0].to_ascii().to_upper().to_char()); + s.push_char(prefix_.as_bytes()[0].to_ascii() + .to_uppercase().to_char()); s.push_char(':'); } Some(VerbatimDiskPrefix) => { s.push_str(prefix_.slice_to(4)); - s.push_char(prefix_.as_bytes()[4].to_ascii().to_upper().to_char()); + s.push_char(prefix_.as_bytes()[4].to_ascii() + .to_uppercase().to_char()); s.push_str(prefix_.slice_from(5)); } Some(UNCPrefix(a,b)) => { @@ -1619,7 +1621,7 @@ mod tests { t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"e"], b"a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"\\e", b"f"], b"\\e\\f"); - t!(v: b"a\\b\\c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], + t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()], b"a\\b\\c\\d\\e"); } @@ -1759,7 +1761,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b"a\\b\\c", [b"d", b"e"], b"a\\b\\c\\d\\e"); - t!(v: b"a\\b\\c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], + t!(v: b"a\\b\\c", [b"d".to_vec(), b"e".to_vec()], b"a\\b\\c\\d\\e"); } |
