Skip to content

Commit 11a188a

Browse files
committed
Add test for issue-70944
1 parent 7db8904 commit 11a188a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/test/ui/traits/issue-70944.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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() {}

0 commit comments

Comments
 (0)