-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce as_slice
/as_mut_slice
methods on std::vec::IntoIter
struct.
#35447
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
This could also have |
I think so. I can add it in.
This works for me too; if anyone has strong opinions on this let me know. |
Aren't trait impls insta-stable? |
as_slice
method on std::vec::IntoIter
struct.as_slice
/as_mut_slice
methods on std::vec::IntoIter
struct.
290d093
to
684800f
Compare
6a7fa66
to
ce58686
Compare
📌 Commit ce58686 has been approved by |
@bors: r- Er wait actually, could you open a tracking issue for these methods and update the unstable issue reference? |
Similar to the `as_slice` method on `core::slice::Iter` struct.
ce58686
to
01a766e
Compare
Done. diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs
index bce1fca..a6f817a 100644
--- a/src/libcollections/vec.rs
+++ b/src/libcollections/vec.rs
@@ -1726,7 +1726,7 @@ impl<T> IntoIter<T> {
/// let _ = into_iter.next().unwrap();
/// assert_eq!(into_iter.as_slice(), &['b', 'c']);
/// ```
- #[unstable(feature = "vec_into_iter_as_slice", issue = "0")]
+ #[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
pub fn as_slice(&self) -> &[T] {
unsafe {
slice::from_raw_parts(self.ptr, self.len())
@@ -1747,7 +1747,7 @@ impl<T> IntoIter<T> {
/// assert_eq!(into_iter.next().unwrap(), 'b');
/// assert_eq!(into_iter.next().unwrap(), 'z');
/// ```
- #[unstable(feature = "vec_into_iter_as_slice", issue = "0")]
+ #[unstable(feature = "vec_into_iter_as_slice", issue = "35601")]
pub fn as_mut_slice(&self) -> &mut [T] {
unsafe {
slice::from_raw_parts_mut(self.ptr, self.len()) |
@bors: r+ Thanks! |
📌 Commit 01a766e has been approved by |
…alexcrichton Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct. Similar to the `as_slice` method on `core::slice::Iter` struct.
…alexcrichton Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct. Similar to the `as_slice` method on `core::slice::Iter` struct.
⌛ Testing commit 01a766e with merge a9a61fb... |
💔 Test failed - auto-linux-64-debug-opt |
@bors: retry On Sat, Aug 13, 2016 at 8:36 PM, bors notifications@github.com wrote:
|
@bors rollup |
…alexcrichton Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct. Similar to the `as_slice` method on `core::slice::Iter` struct.
…alexcrichton Introduce `as_slice`/`as_mut_slice` methods on `std::vec::IntoIter` struct. Similar to the `as_slice` method on `core::slice::Iter` struct.
Rollup of 30 pull requests - Successful merges: #34941, #35392, #35444, #35447, #35491, #35533, #35539, #35558, #35573, #35574, #35577, #35586, #35588, #35594, #35596, #35597, #35598, #35606, #35611, #35615, #35616, #35620, #35622, #35640, #35643, #35644, #35646, #35647, #35648, #35661 - Failed merges: #35395, #35415
Display all the remaining items of the iterator, similar to the `Debug` implementation for `core::slice::Iter`: https://github.com/rust-lang/rust/blob/f0bab98695f0a4877daabad9a5b0ba3e66121392/src/libcore/slice.rs#L930-L937 Using the `as_slice` method that was added in: rust-lang#35447
The switch from I thought we had tests for this. |
…xcrichton Implement `Debug` for `std::vec::IntoIter`. Display all the remaining items of the iterator, similar to the `Debug` implementation for `core::slice::Iter`: https://github.com/rust-lang/rust/blob/f0bab98695f0a4877daabad9a5b0ba3e66121392/src/libcore/slice.rs#L930-L937 Using the `as_slice` method that was added in: rust-lang#35447
…xcrichton Implement `Debug` for `std::vec::IntoIter`. Display all the remaining items of the iterator, similar to the `Debug` implementation for `core::slice::Iter`: https://github.com/rust-lang/rust/blob/f0bab98695f0a4877daabad9a5b0ba3e66121392/src/libcore/slice.rs#L930-L937 Using the `as_slice` method that was added in: rust-lang#35447
Similar to the
as_slice
method oncore::slice::Iter
struct.