Skip to content

Commit 1e3bc5a

Browse files
committed
Allow using Vec::<T>::place_back for T: !Clone
The place_back was likely put into block with `T: Clone` bound by mistake.
1 parent e1cec5d commit 1e3bc5a

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/libcollections/vec.rs

+23-23
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,29 @@ impl<T> Vec<T> {
972972
}
973973
}
974974

975+
/// Returns a place for insertion at the back of the `Vec`.
976+
///
977+
/// Using this method with placement syntax is equivalent to [`push`](#method.push),
978+
/// but may be more efficient.
979+
///
980+
/// # Examples
981+
///
982+
/// ```
983+
/// #![feature(collection_placement)]
984+
/// #![feature(placement_in_syntax)]
985+
///
986+
/// let mut vec = vec![1, 2];
987+
/// vec.place_back() <- 3;
988+
/// vec.place_back() <- 4;
989+
/// assert_eq!(&vec, &[1, 2, 3, 4]);
990+
/// ```
991+
#[unstable(feature = "collection_placement",
992+
reason = "placement protocol is subject to change",
993+
issue = "30172")]
994+
pub fn place_back(&mut self) -> PlaceBack<T> {
995+
PlaceBack { vec: self }
996+
}
997+
975998
/// Removes the last element from a vector and returns it, or [`None`] if it
976999
/// is empty.
9771000
///
@@ -1266,29 +1289,6 @@ impl<T: Clone> Vec<T> {
12661289
pub fn extend_from_slice(&mut self, other: &[T]) {
12671290
self.spec_extend(other.iter())
12681291
}
1269-
1270-
/// Returns a place for insertion at the back of the `Vec`.
1271-
///
1272-
/// Using this method with placement syntax is equivalent to [`push`](#method.push),
1273-
/// but may be more efficient.
1274-
///
1275-
/// # Examples
1276-
///
1277-
/// ```
1278-
/// #![feature(collection_placement)]
1279-
/// #![feature(placement_in_syntax)]
1280-
///
1281-
/// let mut vec = vec![1, 2];
1282-
/// vec.place_back() <- 3;
1283-
/// vec.place_back() <- 4;
1284-
/// assert_eq!(&vec, &[1, 2, 3, 4]);
1285-
/// ```
1286-
#[unstable(feature = "collection_placement",
1287-
reason = "placement protocol is subject to change",
1288-
issue = "30172")]
1289-
pub fn place_back(&mut self) -> PlaceBack<T> {
1290-
PlaceBack { vec: self }
1291-
}
12921292
}
12931293

12941294
// Set the length of the vec when the `SetLenOnDrop` value goes out of scope.

0 commit comments

Comments
 (0)