about summary refs log tree commit diff
path: root/src/liballoc/vec.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-30 16:56:49 +0100
committerGitHub <noreply@github.com>2019-11-30 16:56:49 +0100
commit9ae7fb3e712e6aa166a543fbf69ecb3df0b90052 (patch)
tree706c6bcddad2cb2057856871bfef5b77ef16a872 /src/liballoc/vec.rs
parent123406cac7168fa2e169b404b852d1d265f34c99 (diff)
parentf8a4b6d2ba2ad2a0897cd26cf6196cca23045f96 (diff)
downloadrust-9ae7fb3e712e6aa166a543fbf69ecb3df0b90052.tar.gz
rust-9ae7fb3e712e6aa166a543fbf69ecb3df0b90052.zip
Rollup merge of #66759 - CAD97:patch-3, r=KodrAus
impl TrustedLen for vec::Drain

The iterator methods just forward to `slice::Iter`, which is `TrustedLen`.

This can probably be applied to other `Drain` structs as well.
Diffstat (limited to 'src/liballoc/vec.rs')
-rw-r--r--src/liballoc/vec.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs
index 8892e186d0a..1a700b99056 100644
--- a/src/liballoc/vec.rs
+++ b/src/liballoc/vec.rs
@@ -2703,6 +2703,9 @@ impl<T> ExactSizeIterator for Drain<'_, T> {
     }
 }
 
+#[unstable(feature = "trusted_len", issue = "37572")]
+unsafe impl<T> TrustedLen for Drain<'_, T> {}
+
 #[stable(feature = "fused", since = "1.26.0")]
 impl<T> FusedIterator for Drain<'_, T> {}