rust/tests/crashes/131342-2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
595 B
Rust
Raw Normal View History

2024-10-09 08:34:45 -05:00
//@ known-bug: #131342
// see also: 131342.rs
fn main() {
problem_thingy(Once);
}
struct Once;
impl Iterator for Once {
type Item = ();
}
fn problem_thingy(items: impl Iterator) {
let peeker = items.peekable();
problem_thingy(&peeker);
}
trait Iterator {
type Item;
fn peekable(self) -> Peekable<Self>
where
Self: Sized,
{
loop {}
}
}
struct Peekable<I: Iterator> {
_peeked: I::Item,
}
impl<I: Iterator> Iterator for Peekable<I> {
type Item = I::Item;
}
impl<I: Iterator + ?Sized> Iterator for &I {
type Item = I::Item;
}