Make vec::Drain and binary_heap::Drain covariant

This commit is contained in:
Thomas Garcia 2016-07-21 01:03:40 -07:00
parent 936bfea94b
commit 97d082c6cd
4 changed files with 40 additions and 48 deletions

View file

@ -9,6 +9,7 @@
// except according to those terms.
use std::collections::BinaryHeap;
use std::collections::binary_heap::Drain;
#[test]
fn test_iterator() {
@ -292,3 +293,8 @@ fn test_extend_specialization() {
assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
}
#[allow(dead_code)]
fn assert_covariance() {
fn drain<'new>(d: Drain<&'static str>) -> Drain<&'new str> { d }
}