core: lift FIXME comment from option.rs to iter::try_process

This FIXME is relevant not only to Option but other similar cases that
use iter::try_process(). The referenced issue 11084 was closed in 2021,
and the related PR 59605 was not merged due to inconclusive results.
This commit is contained in:
Tim Siegel
2026-03-04 14:09:56 -05:00
parent 4efe3dc40f
commit ea674ecb09
2 changed files with 3 additions and 3 deletions
+3
View File
@@ -155,6 +155,9 @@ pub(crate) fn try_process<I, T, R, F, U>(iter: I, mut f: F) -> ChangeOutputType<
for<'a> F: FnMut(GenericShunt<'a, I, R>) -> U,
R: Residual<U>,
{
// FIXME(#11084): we might be able to get rid of GenericShunt in favor of
// Iterator::scan, as performance should be comparable
let mut residual = None;
let shunt = GenericShunt { iter, residual: &mut residual };
let value = f(shunt);
-3
View File
@@ -2758,9 +2758,6 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
/// so the final value of `shared` is 6 (= `3 + 2 + 1`), not 16.
#[inline]
fn from_iter<I: IntoIterator<Item = Option<A>>>(iter: I) -> Option<V> {
// FIXME(#11084): This could be replaced with Iterator::scan when this
// performance bug is closed.
iter::try_process(iter.into_iter(), |i| i.collect())
}
}