diff options
Diffstat (limited to 'src/test/ui/generic-associated-types/bugs/issue-88382.rs')
-rw-r--r-- | src/test/ui/generic-associated-types/bugs/issue-88382.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/generic-associated-types/bugs/issue-88382.rs b/src/test/ui/generic-associated-types/bugs/issue-88382.rs new file mode 100644 index 000000000..5493b9b93 --- /dev/null +++ b/src/test/ui/generic-associated-types/bugs/issue-88382.rs @@ -0,0 +1,31 @@ +// check-fail +// known-bug: #88382 + +// This should pass, but has a missed normalization due to HRTB. + +#![feature(generic_associated_types)] + +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>) {} |