diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-41742.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-41742.rs b/src/test/ui/issues/issue-41742.rs new file mode 100644 index 000000000..afe311b4d --- /dev/null +++ b/src/test/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 +} |