From 11a188a194b0f62945e8bfb76534f7198e08effe Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 08:35:29 +0900 Subject: [PATCH] Add test for issue-70944 --- src/test/ui/traits/issue-70944.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/test/ui/traits/issue-70944.rs diff --git a/src/test/ui/traits/issue-70944.rs b/src/test/ui/traits/issue-70944.rs new file mode 100644 index 00000000000..3286de9d5b8 --- /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 + Index + Index {} +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() {}