summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/issue-70944.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/traits/issue-70944.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/traits/issue-70944.rs b/src/test/ui/traits/issue-70944.rs
new file mode 100644
index 000000000..3286de9d5
--- /dev/null
+++ b/src/test/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() {}