Skip to content

Commit

Permalink
Rollup merge of rust-lang#66759 - CAD97:patch-3, r=KodrAus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Centril authored Nov 30, 2019
2 parents 123406c + f8a4b6d commit 9ae7fb3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {}

Expand Down

0 comments on commit 9ae7fb3

Please sign in to comment.