Open
Description
Code
I tried to pair it down more, but so far this is the smallest version I could get to cause the issue:
pub trait LendingIterator {
type Item<'a>
where
Self: 'a;
fn next<'a>(&'a mut self) -> Self::Item<'a>
where
Self: 'a;
fn filter<P>(self, predicate: P) -> Filter<Self, P>
where
Self: Sized,
for<'a> P: FnMut(&Self::Item<'a>) -> bool,
{
Filter {
stream: self,
predicate,
}
}
}
#[derive(Clone, Debug)]
pub struct Filter<S, P> {
stream: S,
predicate: P,
}
impl<S, P> LendingIterator for Filter<S, P>
where
S: LendingIterator + Unpin,
for<'a> P: FnMut(&Self::Item<'a>) -> bool,
{
type Item<'a> = S::Item<'a> where S: 'a;
fn next<'a>(&'a mut self) -> Self::Item<'a>
where
Self: 'a,
{
loop {
let next = self.stream.next()?;
if (self.predicate)(&next) {
return Some(());
}
}
}
}
Meta
rustc --version --verbose
:
rustc 1.70.0-nightly (7820b62d2 2023-03-05)
binary: rustc
commit-hash: 7820b62d20bc548096d4632a3487987308cb4b5d
commit-date: 2023-03-05
host: x86_64-pc-windows-msvc
release: 1.70.0-nightly
LLVM version: 15.0.7
and
rustc 1.67.1 (d5a82bbd2 2023-02-07)
binary: rustc
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
commit-date: 2023-02-07
host: x86_64-pc-windows-gnu
release: 1.67.1
LLVM version: 15.0.6
Error output
There isn't any error output, since the compiler runs indefinitely when encountering this issue.