blob: 8f8cc4523a202b8ee48ea56ee28f2d419f7a38bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// check-fail
// known-bug: #88382
// This should pass, but has a missed normalization due to HRTB.
trait Iterable {
type Iterator<'a> where Self: 'a;
fn iter(&self) -> Self::Iterator<'_>;
}
struct SomeImplementation();
impl Iterable for SomeImplementation {
type Iterator<'a> = std::iter::Empty<usize>;
fn iter(&self) -> Self::Iterator<'_> {
std::iter::empty()
}
}
fn do_something<I: Iterable>(i: I, mut f: impl for<'a> Fn(&mut I::Iterator<'a>)) {
f(&mut i.iter());
}
fn main() {
do_something(SomeImplementation(), |_| ());
do_something(SomeImplementation(), test);
}
fn test<'a, I: Iterable>(_: &mut I::Iterator<'a>) {}
|