summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-41742.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/issues/issue-41742.rs')
-rw-r--r--tests/ui/issues/issue-41742.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/issues/issue-41742.rs b/tests/ui/issues/issue-41742.rs
new file mode 100644
index 000000000..afe311b4d
--- /dev/null
+++ b/tests/ui/issues/issue-41742.rs
@@ -0,0 +1,25 @@
+use std::ops::{Index, IndexMut};
+
+struct S;
+struct H;
+
+impl S {
+ fn f(&mut self) {}
+}
+
+impl Index<u32> for H {
+ type Output = S;
+ fn index(&self, index: u32) -> &S {
+ unimplemented!()
+ }
+}
+
+impl IndexMut<u32> for H {
+ fn index_mut(&mut self, index: u32) -> &mut S {
+ unimplemented!()
+ }
+}
+
+fn main() {
+ H["?"].f(); //~ ERROR mismatched types
+}