about summary refs log tree commit diff
path: root/tests/ui/traits/issue-70944.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits/issue-70944.rs')
-rw-r--r--tests/ui/traits/issue-70944.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/traits/issue-70944.rs b/tests/ui/traits/issue-70944.rs
new file mode 100644
index 00000000000..3286de9d5b8
--- /dev/null
+++ b/tests/ui/traits/issue-70944.rs
@@ -0,0 +1,23 @@
+// check-pass
+// Regression test of #70944, should compile fine.
+
+use std::ops::Index;
+
+pub struct KeyA;
+pub struct KeyB;
+pub struct KeyC;
+
+pub trait Foo: Index<KeyA> + Index<KeyB> + Index<KeyC> {}
+pub trait FooBuilder {
+    type Inner: Foo;
+    fn inner(&self) -> &Self::Inner;
+}
+
+pub fn do_stuff(foo: &impl FooBuilder) {
+    let inner = foo.inner();
+    &inner[KeyA];
+    &inner[KeyB];
+    &inner[KeyC];
+}
+
+fn main() {}