summaryrefslogtreecommitdiffstats
path: root/tests/ui/generic-associated-types/bugs/issue-88382.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/generic-associated-types/bugs/issue-88382.rs')
-rw-r--r--tests/ui/generic-associated-types/bugs/issue-88382.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/generic-associated-types/bugs/issue-88382.rs b/tests/ui/generic-associated-types/bugs/issue-88382.rs
new file mode 100644
index 000000000..8f8cc4523
--- /dev/null
+++ b/tests/ui/generic-associated-types/bugs/issue-88382.rs
@@ -0,0 +1,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>) {}