Skip to content

Commit 8fda16f

Browse files
committed
---
yaml --- r: 271889 b: refs/heads/master c: 589108b h: refs/heads/master i: 271887: a9d8257
1 parent 2310692 commit 8fda16f

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 1639f2d2899310038635be2c307b60adf2bde125
2+
refs/heads/master: 589108baf644ea44a10a7258d67da254e1e09fae
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/libstd/collections/hash/map.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,20 @@ impl<K, S, Q: ?Sized> super::Recover<Q> for HashMap<K, (), S>
16701670
}
16711671
}
16721672

1673+
#[allow(dead_code)]
1674+
fn assert_covariance() {
1675+
fn map_key<'new>(v: HashMap<&'static str, u8>) -> HashMap<&'new str, u8> { v }
1676+
fn map_val<'new>(v: HashMap<u8, &'static str>) -> HashMap<u8, &'new str> { v }
1677+
fn iter_key<'a, 'new>(v: Iter<'a, &'static str, u8>) -> Iter<'a, &'new str, u8> { v }
1678+
fn iter_val<'a, 'new>(v: Iter<'a, u8, &'static str>) -> Iter<'a, u8, &'new str> { v }
1679+
fn into_iter_key<'new>(v: IntoIter<&'static str, u8>) -> IntoIter<&'new str, u8> { v }
1680+
fn into_iter_val<'new>(v: IntoIter<u8, &'static str>) -> IntoIter<u8, &'new str> { v }
1681+
fn keys_key<'a, 'new>(v: Keys<'a, &'static str, u8>) -> Keys<'a, &'new str, u8> { v }
1682+
fn keys_val<'a, 'new>(v: Keys<'a, u8, &'static str>) -> Keys<'a, u8, &'new str> { v }
1683+
fn values_key<'a, 'new>(v: Values<'a, &'static str, u8>) -> Values<'a, &'new str, u8> { v }
1684+
fn values_val<'a, 'new>(v: Values<'a, u8, &'static str>) -> Values<'a, u8, &'new str> { v }
1685+
}
1686+
16731687
#[cfg(test)]
16741688
mod test_map {
16751689
use prelude::v1::*;

trunk/src/libstd/collections/hash/set.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,21 @@ impl<'a, T, S> Iterator for Union<'a, T, S>
10241024
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
10251025
}
10261026

1027+
#[allow(dead_code)]
1028+
fn assert_covariance() {
1029+
fn set<'new>(v: HashSet<&'static str>) -> HashSet<&'new str> { v }
1030+
fn iter<'a, 'new>(v: Iter<'a, &'static str>) -> Iter<'a, &'new str> { v }
1031+
fn into_iter<'new>(v: IntoIter<&'static str>) -> IntoIter<&'new str> { v }
1032+
fn difference<'a, 'new>(v: Difference<'a, &'static str, RandomState>)
1033+
-> Difference<'a, &'new str, RandomState> { v }
1034+
fn symmetric_difference<'a, 'new>(v: SymmetricDifference<'a, &'static str, RandomState>)
1035+
-> SymmetricDifference<'a, &'new str, RandomState> { v }
1036+
fn intersection<'a, 'new>(v: Intersection<'a, &'static str, RandomState>)
1037+
-> Intersection<'a, &'new str, RandomState> { v }
1038+
fn union<'a, 'new>(v: Union<'a, &'static str, RandomState>)
1039+
-> Union<'a, &'new str, RandomState> { v }
1040+
}
1041+
10271042
#[cfg(test)]
10281043
mod test_set {
10291044
use prelude::v1::*;

0 commit comments

Comments
 (0)