Skip to content

Commit dbc43ec

Browse files
committed
Revert "implement TrustedRandomAccess for Take iterator adapter"
This reverts commit 37a5b51.
1 parent 2577825 commit dbc43ec

File tree

1 file changed

+1
-22
lines changed
  • library/core/src/iter/adapters

1 file changed

+1
-22
lines changed

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

+1-22
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use crate::cmp;
2-
use crate::iter::{
3-
adapters::zip::try_get_unchecked, adapters::SourceIter, FusedIterator, InPlaceIterable,
4-
TrustedLen, TrustedRandomAccess,
5-
};
2+
use crate::iter::{adapters::SourceIter, FusedIterator, InPlaceIterable, TrustedLen};
63
use crate::ops::{ControlFlow, Try};
74

85
/// An iterator that only iterates over the first `n` iterations of `iter`.
@@ -114,15 +111,6 @@ where
114111

115112
self.try_fold(init, ok(fold)).unwrap()
116113
}
117-
118-
unsafe fn __iterator_get_unchecked(&mut self, idx: usize) -> <I as Iterator>::Item
119-
where
120-
Self: TrustedRandomAccess,
121-
{
122-
// SAFETY: the caller must uphold the contract for
123-
// `Iterator::__iterator_get_unchecked`.
124-
unsafe { try_get_unchecked(&mut self.iter, idx) }
125-
}
126114
}
127115

128116
#[unstable(issue = "none", feature = "inplace_iteration")]
@@ -219,12 +207,3 @@ impl<I> FusedIterator for Take<I> where I: FusedIterator {}
219207

220208
#[unstable(feature = "trusted_len", issue = "37572")]
221209
unsafe impl<I: TrustedLen> TrustedLen for Take<I> {}
222-
223-
#[doc(hidden)]
224-
#[unstable(feature = "trusted_random_access", issue = "none")]
225-
unsafe impl<I> TrustedRandomAccess for Take<I>
226-
where
227-
I: TrustedRandomAccess,
228-
{
229-
const MAY_HAVE_SIDE_EFFECT: bool = I::MAY_HAVE_SIDE_EFFECT;
230-
}

0 commit comments

Comments
 (0)