Add test for issue-70944

This commit is contained in:
Yuki Okushi 2020-10-15 08:35:29 +09:00
parent 7db8904518
commit 11a188a194

View File

@ -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() {}