diff options
| author | Thomas Garcia <thomasjgarcia1@gmail.com> | 2016-07-21 01:03:40 -0700 |
|---|---|---|
| committer | Thomas Garcia <thomasjgarcia1@gmail.com> | 2016-07-21 01:03:40 -0700 |
| commit | 97d082c6cdc05c0ac7f37f7a0c0b3a2f9fe698e3 (patch) | |
| tree | 04891668f3286fdd9e798782eebfa71301efc4b9 /src/libcollectionstest | |
| parent | 936bfea94b800551c972e5689ae7da86d3d601de (diff) | |
Make vec::Drain and binary_heap::Drain covariant
Diffstat (limited to 'src/libcollectionstest')
| -rw-r--r-- | src/libcollectionstest/binary_heap.rs | 6 | ||||
| -rw-r--r-- | src/libcollectionstest/vec.rs | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/libcollectionstest/binary_heap.rs b/src/libcollectionstest/binary_heap.rs index be933abe41f..39efc9fc22c 100644 --- a/src/libcollectionstest/binary_heap.rs +++ b/src/libcollectionstest/binary_heap.rs @@ -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 } +} diff --git a/src/libcollectionstest/vec.rs b/src/libcollectionstest/vec.rs index cb99659cc0e..01656b44a84 100644 --- a/src/libcollectionstest/vec.rs +++ b/src/libcollectionstest/vec.rs @@ -11,6 +11,7 @@ use std::borrow::Cow; use std::iter::{FromIterator, repeat}; use std::mem::size_of; +use std::vec::Drain; use test::Bencher; @@ -510,6 +511,11 @@ fn test_cow_from() { } } +#[allow(dead_code)] +fn assert_covariance() { + fn drain<'new>(d: Drain<&'static str>) -> Drain<&'new str> { d } +} + #[bench] fn bench_new(b: &mut Bencher) { b.iter(|| { |
