]>
git.proxmox.com Git - rustc.git/blob - tests/ui/overloaded/overloaded-index-in-field.rs
2 // Test using overloaded indexing when the "map" is stored in a
3 // field. This caused problems at some point.
16 impl Index
<isize> for Foo
{
19 fn index(&self, z
: isize) -> &isize {
29 fn get(self) -> isize;
30 fn get_from_ref(&self) -> isize;
35 fn get(self) -> isize { self }
36 fn get_from_ref(&self) -> isize { *self }
37 fn inc(&mut self) { *self += 1; }
41 let f
= Bar
{ foo
: Foo
{
45 assert_eq
!(f
.foo
[1].get(), 2);