about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-15 08:09:38 +0000
committerbors <bors@rust-lang.org>2020-06-15 08:09:38 +0000
commitd4ecf31efc2309fb6df8c2a8af9aaf8176ab1c8d (patch)
tree90b5827146e0a10bf9936642765ffdcb7eb177cd /src/liballoc
parentce6d3a73b514e9649e57cee812ad129bb2112016 (diff)
parentbca9e90f9f190ed94033d674f195b141dbaf5ec6 (diff)
downloadrust-d4ecf31efc2309fb6df8c2a8af9aaf8176ab1c8d.tar.gz
rust-d4ecf31efc2309fb6df8c2a8af9aaf8176ab1c8d.zip
Auto merge of #73367 - RalfJung:rollup-4ewvk9b, r=RalfJung
Rollup of 10 pull requests

Successful merges:

 - #71824 (Check for live drops in constants after drop elaboration)
 - #72389 (Explain move errors that occur due to method calls involving `self`)
 - #72556 (Fix trait alias inherent impl resolution)
 - #72584 (Stabilize vec::Drain::as_slice)
 - #72598 (Display information about captured variable in `FnMut` error)
 - #73336 (Group `Pattern::strip_*` method together)
 - #73341 (_match.rs: fix module doc comment)
 - #73342 (Fix iterator copied() documentation example code)
 - #73351 (Update E0446.md)
 - #73353 (structural_match: non-structural-match ty closures)

Failed merges:

r? @ghost
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/vec.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 2226737757b..06462fd96d9 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -2779,19 +2779,25 @@ impl<'a, T> Drain<'a, T> {
     /// # Examples
     ///
     /// ```
-    /// # #![feature(vec_drain_as_slice)]
     /// let mut vec = vec!['a', 'b', 'c'];
     /// let mut drain = vec.drain(..);
     /// assert_eq!(drain.as_slice(), &['a', 'b', 'c']);
     /// let _ = drain.next().unwrap();
     /// assert_eq!(drain.as_slice(), &['b', 'c']);
     /// ```
-    #[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "58957")]
+    #[stable(feature = "vec_drain_as_slice", since = "1.46.0")]
     pub fn as_slice(&self) -> &[T] {
         self.iter.as_slice()
     }
 }
 
+#[stable(feature = "vec_drain_as_slice", since = "1.46.0")]
+impl<'a, T> AsRef<[T]> for Drain<'a, T> {
+    fn as_ref(&self) -> &[T] {
+        self.as_slice()
+    }
+}
+
 #[stable(feature = "drain", since = "1.6.0")]
 unsafe impl<T: Sync> Sync for Drain<'_, T> {}
 #[stable(feature = "drain", since = "1.6.0")]