Skip to content

Commit 3923108

Browse files
committed
Check associated types and consts for well-formedness
Because we don't check the well-formedness of region relationships of an impl's on the Self-type, or infer region relationss from them, many impls now have to specify their region relations, making this a [breaking-change]. The most common pattern I found that is now broken is that impl<'a, T> IntoIterator for &'a Collection<T> { type Item = &'a T; type IntoIter = ...; } now has to specify its `T: 'a` bound.
1 parent 892666a commit 3923108

File tree

20 files changed

+165
-121
lines changed

20 files changed

+165
-121
lines changed

src/libcollections/binary_heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
675675
}
676676

677677
#[stable(feature = "rust1", since = "1.0.0")]
678-
impl<'a, T> IntoIterator for &'a BinaryHeap<T> where T: Ord {
678+
impl<'a, T: 'a> IntoIterator for &'a BinaryHeap<T> where T: Ord {
679679
type Item = &'a T;
680680
type IntoIter = Iter<'a, T>;
681681

src/libcollections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ impl<K, V> IntoIterator for BTreeMap<K, V> {
500500
}
501501

502502
#[stable(feature = "rust1", since = "1.0.0")]
503-
impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
503+
impl<'a, K: 'a, V: 'a> IntoIterator for &'a BTreeMap<K, V> {
504504
type Item = (&'a K, &'a V);
505505
type IntoIter = Iter<'a, K, V>;
506506

@@ -510,7 +510,7 @@ impl<'a, K, V> IntoIterator for &'a BTreeMap<K, V> {
510510
}
511511

512512
#[stable(feature = "rust1", since = "1.0.0")]
513-
impl<'a, K, V> IntoIterator for &'a mut BTreeMap<K, V> {
513+
impl<'a, K: 'a, V: 'a> IntoIterator for &'a mut BTreeMap<K, V> {
514514
type Item = (&'a K, &'a mut V);
515515
type IntoIter = IterMut<'a, K, V>;
516516

src/libcollections/btree/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ impl<T> IntoIterator for BTreeSet<T> {
490490
}
491491

492492
#[stable(feature = "rust1", since = "1.0.0")]
493-
impl<'a, T> IntoIterator for &'a BTreeSet<T> {
493+
impl<'a, T: 'a> IntoIterator for &'a BTreeSet<T> {
494494
type Item = &'a T;
495495
type IntoIter = Iter<'a, T>;
496496

src/libcollections/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<E:CLike> FromIterator<E> for EnumSet<E> {
272272
}
273273

274274
#[stable(feature = "rust1", since = "1.0.0")]
275-
impl<'a, E> IntoIterator for &'a EnumSet<E> where E: CLike {
275+
impl<'a, E: 'a> IntoIterator for &'a EnumSet<E> where E: CLike {
276276
type Item = E;
277277
type IntoIter = Iter<E>;
278278

src/libcollections/linked_list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ impl<T> IntoIterator for LinkedList<T> {
846846
}
847847

848848
#[stable(feature = "rust1", since = "1.0.0")]
849-
impl<'a, T> IntoIterator for &'a LinkedList<T> {
849+
impl<'a, T: 'a> IntoIterator for &'a LinkedList<T> {
850850
type Item = &'a T;
851851
type IntoIter = Iter<'a, T>;
852852

@@ -855,7 +855,7 @@ impl<'a, T> IntoIterator for &'a LinkedList<T> {
855855
}
856856
}
857857

858-
impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
858+
impl<'a, T: 'a> IntoIterator for &'a mut LinkedList<T> {
859859
type Item = &'a mut T;
860860
type IntoIter = IterMut<'a, T>;
861861

src/libcollections/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,7 +1562,7 @@ impl<T> IntoIterator for Vec<T> {
15621562
}
15631563

15641564
#[stable(feature = "rust1", since = "1.0.0")]
1565-
impl<'a, T> IntoIterator for &'a Vec<T> {
1565+
impl<'a, T: 'a> IntoIterator for &'a Vec<T> {
15661566
type Item = &'a T;
15671567
type IntoIter = slice::Iter<'a, T>;
15681568

@@ -1572,7 +1572,7 @@ impl<'a, T> IntoIterator for &'a Vec<T> {
15721572
}
15731573

15741574
#[stable(feature = "rust1", since = "1.0.0")]
1575-
impl<'a, T> IntoIterator for &'a mut Vec<T> {
1575+
impl<'a, T: 'a> IntoIterator for &'a mut Vec<T> {
15761576
type Item = &'a mut T;
15771577
type IntoIter = slice::IterMut<'a, T>;
15781578

src/libcollections/vec_deque.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,7 +1757,7 @@ impl<T> IntoIterator for VecDeque<T> {
17571757
}
17581758

17591759
#[stable(feature = "rust1", since = "1.0.0")]
1760-
impl<'a, T> IntoIterator for &'a VecDeque<T> {
1760+
impl<'a, T: 'a> IntoIterator for &'a VecDeque<T> {
17611761
type Item = &'a T;
17621762
type IntoIter = Iter<'a, T>;
17631763

@@ -1767,7 +1767,7 @@ impl<'a, T> IntoIterator for &'a VecDeque<T> {
17671767
}
17681768

17691769
#[stable(feature = "rust1", since = "1.0.0")]
1770-
impl<'a, T> IntoIterator for &'a mut VecDeque<T> {
1770+
impl<'a, T: 'a> IntoIterator for &'a mut VecDeque<T> {
17711771
type Item = &'a mut T;
17721772
type IntoIter = IterMut<'a, T>;
17731773

src/libcollections/vec_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ impl<T> IntoIterator for VecMap<T> {
800800
}
801801

802802
#[stable(feature = "rust1", since = "1.0.0")]
803-
impl<'a, T> IntoIterator for &'a VecMap<T> {
803+
impl<'a, T: 'a> IntoIterator for &'a VecMap<T> {
804804
type Item = (usize, &'a T);
805805
type IntoIter = Iter<'a, T>;
806806

@@ -810,7 +810,7 @@ impl<'a, T> IntoIterator for &'a VecMap<T> {
810810
}
811811

812812
#[stable(feature = "rust1", since = "1.0.0")]
813-
impl<'a, T> IntoIterator for &'a mut VecMap<T> {
813+
impl<'a, T: 'a> IntoIterator for &'a mut VecMap<T> {
814814
type Item = (usize, &'a mut T);
815815
type IntoIter = IterMut<'a, T>;
816816

src/libcore/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ macro_rules! array_impls {
9494
}
9595

9696
#[stable(feature = "rust1", since = "1.0.0")]
97-
impl<'a, T> IntoIterator for &'a [T; $N] {
97+
impl<'a, T: 'a> IntoIterator for &'a [T; $N] {
9898
type Item = &'a T;
9999
type IntoIter = Iter<'a, T>;
100100

@@ -104,7 +104,7 @@ macro_rules! array_impls {
104104
}
105105

106106
#[stable(feature = "rust1", since = "1.0.0")]
107-
impl<'a, T> IntoIterator for &'a mut [T; $N] {
107+
impl<'a, T: 'a> IntoIterator for &'a mut [T; $N] {
108108
type Item = &'a mut T;
109109
type IntoIter = IterMut<'a, T>;
110110

src/libcore/slice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ impl<'a, T> Default for &'a [T] {
647647
//
648648

649649
#[stable(feature = "rust1", since = "1.0.0")]
650-
impl<'a, T> IntoIterator for &'a [T] {
650+
impl<'a, T: 'a> IntoIterator for &'a [T] {
651651
type Item = &'a T;
652652
type IntoIter = Iter<'a, T>;
653653

@@ -657,7 +657,7 @@ impl<'a, T> IntoIterator for &'a [T] {
657657
}
658658

659659
#[stable(feature = "rust1", since = "1.0.0")]
660-
impl<'a, T> IntoIterator for &'a mut [T] {
660+
impl<'a, T: 'a> IntoIterator for &'a mut [T] {
661661
type Item = &'a mut T;
662662
type IntoIter = IterMut<'a, T>;
663663

0 commit comments

Comments
 (0)