Skip to content

Commit 67d01d5

Browse files
committed
Fix inplace_iteration related impls
1 parent 9648fb5 commit 67d01d5

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

library/core/src/iter/adapters/dedup.rs

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
2+
13
use crate::iter::{InPlaceIterable, SourceIter};
24

35
/// A wrapper type around a key function.
@@ -9,7 +11,6 @@ use crate::iter::{InPlaceIterable, SourceIter};
911
/// See its documentation for more.
1012
///
1113
/// [`Iterator::dedup_by_key`]: Iterator::dedup_by_key
12-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
1314
#[derive(Debug, Clone, Copy)]
1415
pub struct ByKey<F> {
1516
key: F,
@@ -22,7 +23,6 @@ impl<F> ByKey<F> {
2223
}
2324
}
2425

25-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
2626
impl<F, T, K> FnOnce<(&T, &T)> for ByKey<F>
2727
where
2828
F: FnMut(&T) -> K,
@@ -35,7 +35,6 @@ where
3535
}
3636
}
3737

38-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
3938
impl<F, T, K> FnMut<(&T, &T)> for ByKey<F>
4039
where
4140
F: FnMut(&T) -> K,
@@ -56,7 +55,6 @@ where
5655
/// See its documentation for more.
5756
///
5857
/// [`Iterator::dedup`]: Iterator::dedup
59-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
6058
#[derive(Debug, Clone, Copy)]
6159
#[non_exhaustive]
6260
pub struct ByPartialEq;
@@ -68,7 +66,6 @@ impl ByPartialEq {
6866
}
6967
}
7068

71-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
7269
impl<T: PartialEq> FnOnce<(&T, &T)> for ByPartialEq {
7370
type Output = bool;
7471
#[inline]
@@ -77,7 +74,6 @@ impl<T: PartialEq> FnOnce<(&T, &T)> for ByPartialEq {
7774
}
7875
}
7976

80-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
8177
impl<T: PartialEq> FnMut<(&T, &T)> for ByPartialEq {
8278
#[inline]
8379
extern "rust-call" fn call_mut(&mut self, args: (&T, &T)) -> Self::Output {
@@ -94,7 +90,6 @@ impl<T: PartialEq> FnMut<(&T, &T)> for ByPartialEq {
9490
/// [`Iterator::dedup`]: Iterator::dedup
9591
/// [`Iterator::dedup_by`]: Iterator::dedup_by
9692
/// [`Iterator::dedup_by_key`]: Iterator::dedup_by_key
97-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
9893
#[derive(Debug, Clone)]
9994
pub struct Dedup<I, F>
10095
where
@@ -115,7 +110,6 @@ where
115110
}
116111
}
117112

118-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
119113
impl<I, F> Iterator for Dedup<I, F>
120114
where
121115
I: Iterator,
@@ -140,22 +134,21 @@ where
140134
}
141135
}
142136

143-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
144-
unsafe impl<S, I, F> SourceIter for Dedup<I, F>
137+
#[unstable(issue = "none", feature = "inplace_iteration")]
138+
unsafe impl<I, F> SourceIter for Dedup<I, F>
145139
where
146-
S: Iterator,
147-
I: Iterator + SourceIter<Source = S>,
140+
I: SourceIter + Iterator,
148141
{
149-
type Source = S;
142+
type Source = I::Source;
150143

151144
#[inline]
152-
unsafe fn as_inner(&mut self) -> &mut Self::Source {
145+
unsafe fn as_inner(&mut self) -> &mut I::Source {
153146
// SAFETY: unsafe function forwarding to unsafe function with the same requirements
154147
unsafe { SourceIter::as_inner(&mut self.inner) }
155148
}
156149
}
157150

158-
#[unstable(feature = "iter_dedup", reason = "recently added", issue = "83748")]
151+
#[unstable(issue = "none", feature = "inplace_iteration")]
159152
unsafe impl<I, F> InPlaceIterable for Dedup<I, F>
160153
where
161154
I: InPlaceIterable,

library/core/src/iter/traits/iterator.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1690,8 +1690,8 @@ pub trait Iterator {
16901690
Inspect::new(self, f)
16911691
}
16921692

1693-
/// Removes all but the first of consecutive elements in the iterator according to the
1694-
/// [`PartialEq`] trait implementation.
1693+
/// Removes all but the first of consecutive repeated elements in the iterator
1694+
/// according to the [`PartialEq`] trait implementation.
16951695
///
16961696
/// For an iterator yielding infinitely many consecutive duplicates,
16971697
/// this may result in an infinite loop.
@@ -1734,11 +1734,11 @@ pub trait Iterator {
17341734
Dedup::new(self, ByPartialEq::new())
17351735
}
17361736

1737-
/// Removes all but the first of consecutive elements in the iterator satisfying a given equality
1738-
/// relation.
1737+
/// Removes all but the first of consecutive elements in the iterator
1738+
/// satisfying a given equality relation.
17391739
///
1740-
/// The `same_bucket` function is passed a references to two elements from the iterator and
1741-
/// must determine if the elements compare equal.
1740+
/// The `same_bucket` function is passed a references to two elements from
1741+
/// the iterator and must determine if the elements compare equal.
17421742
///
17431743
/// For an iterator yielding infinitely many consecutive duplicates,
17441744
/// this may result in an infinite loop.
@@ -1781,8 +1781,8 @@ pub trait Iterator {
17811781
Dedup::new(self, same_bucket)
17821782
}
17831783

1784-
/// Removes all but the first of consecutive elements in the iterator that
1785-
/// resolve to the same key.
1784+
/// Removes all but the first of consecutive elements in the iterator
1785+
/// that resolve to the same key.
17861786
///
17871787
/// For an iterator yielding infinitely many consecutive duplicates,
17881788
/// this may result in an infinite loop.

0 commit comments

Comments
 (0)