Skip to content

Commit

Permalink
Remove into_vec method from &[T]
Browse files Browse the repository at this point in the history
[breaking-change]
Closes #17916
  • Loading branch information
JIghtuse committed Oct 11, 2014
1 parent 1add4de commit 6e29f86
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
12 changes: 7 additions & 5 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,14 @@ pub trait CloneableVector<T> {
}

/// Converts `self` into an owned vector, not making a copy if possible.
/// Deprecated. Use 'to_vec'
#[deprecated = "Replaced by `to_vec`"]
fn into_vec(self) -> Vec<T>;

/// Deprecated. Use `into_vec`
#[deprecated = "Replaced by `into_vec`"]
/// Deprecated. Use `to_vec`
#[deprecated = "Replaced by `to_vec`"]
fn into_owned(self) -> Vec<T> {
self.into_vec()
self.to_vec()
}
}

Expand Down Expand Up @@ -2328,9 +2330,9 @@ mod tests {
}

#[test]
fn test_into_vec() {
fn test_to_vec() {
let xs = box [1u, 2, 3];
let ys = xs.into_vec();
let ys = xs.to_vec();
assert_eq!(ys.as_slice(), [1u, 2, 3].as_slice());
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,13 +614,6 @@ impl<T> Collection for Vec<T> {
}
}

impl<T: Clone> CloneableVector<T> for Vec<T> {
#[deprecated = "call .clone() instead"]
fn to_vec(&self) -> Vec<T> { self.clone() }
#[deprecated = "move the vector instead"]
fn into_vec(self) -> Vec<T> { self }
}

// FIXME: #13996: need a way to mark the return value as `noalias`
#[inline(never)]
unsafe fn alloc_or_realloc<T>(ptr: *mut T, old_size: uint, size: uint) -> *mut T {
Expand Down
2 changes: 1 addition & 1 deletion src/libgraphviz/maybe_owned_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl<'a,T:Clone> CloneableVector<T> for MaybeOwnedVector<'a,T> {
impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> {
fn clone(&self) -> MaybeOwnedVector<'a, T> {
match *self {
Growable(ref v) => Growable(v.to_vec()),
Growable(ref v) => Growable(v.clone()),
Borrowed(v) => Borrowed(v)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {

ty::ty_tup(ref tys) => {
// (T1, ..., Tn) -- meets any bound that all of T1...Tn meet
Ok(If(tys.to_owned()))
Ok(If(tys.clone()))
}

ty::ty_unboxed_closure(def_id, _) => {
Expand Down

5 comments on commit 6e29f86

@bors
Copy link
Contributor

@bors bors commented on 6e29f86 Oct 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at JIghtuse@6e29f86

@bors
Copy link
Contributor

@bors bors commented on 6e29f86 Oct 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging JIghtuse/rust/master = 6e29f86 into auto

@bors
Copy link
Contributor

@bors bors commented on 6e29f86 Oct 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JIghtuse/rust/master = 6e29f86 merged ok, testing candidate = adb44f5

@bors
Copy link
Contributor

@bors bors commented on 6e29f86 Oct 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 6e29f86 Oct 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = adb44f5

Please sign in to comment.