]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/issue-70944.rs
Rollup merge of #82179 - mbartlett21:patch-5, r=joshtriplett
[rust.git] / src / test / ui / traits / issue-70944.rs
1 // check-pass
2 // Regression test of #70944, should compile fine.
3
4 use std::ops::Index;
5
6 pub struct KeyA;
7 pub struct KeyB;
8 pub struct KeyC;
9
10 pub trait Foo: Index<KeyA> + Index<KeyB> + Index<KeyC> {}
11 pub trait FooBuilder {
12     type Inner: Foo;
13     fn inner(&self) -> &Self::Inner;
14 }
15
16 pub fn do_stuff(foo: &impl FooBuilder) {
17     let inner = foo.inner();
18     &inner[KeyA];
19     &inner[KeyB];
20     &inner[KeyC];
21 }
22
23 fn main() {}