2 #![allow(unused_variables)]
7 use core
::ops
::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}
;
9 static mut COUNT
: usize = 0;
13 impl Index
<Range
<Foo
>> for Foo
{
15 fn index(&self, index
: Range
<Foo
>) -> &Foo
{
16 unsafe { COUNT += 1; }
20 impl Index
<RangeTo
<Foo
>> for Foo
{
22 fn index(&self, index
: RangeTo
<Foo
>) -> &Foo
{
23 unsafe { COUNT += 1; }
27 impl Index
<RangeFrom
<Foo
>> for Foo
{
29 fn index(&self, index
: RangeFrom
<Foo
>) -> &Foo
{
30 unsafe { COUNT += 1; }
34 impl Index
<RangeFull
> for Foo
{
36 fn index(&self, _index
: RangeFull
) -> &Foo
{
37 unsafe { COUNT += 1; }
42 impl IndexMut
<Range
<Foo
>> for Foo
{
43 fn index_mut(&mut self, index
: Range
<Foo
>) -> &mut Foo
{
44 unsafe { COUNT += 1; }
48 impl IndexMut
<RangeTo
<Foo
>> for Foo
{
49 fn index_mut(&mut self, index
: RangeTo
<Foo
>) -> &mut Foo
{
50 unsafe { COUNT += 1; }
54 impl IndexMut
<RangeFrom
<Foo
>> for Foo
{
55 fn index_mut(&mut self, index
: RangeFrom
<Foo
>) -> &mut Foo
{
56 unsafe { COUNT += 1; }
60 impl IndexMut
<RangeFull
> for Foo
{
61 fn index_mut(&mut self, _index
: RangeFull
) -> &mut Foo
{
62 unsafe { COUNT += 1; }
75 let _
= &mut x
[Foo
..];
76 let _
= &mut x
[..Foo
];
77 let _
= &mut x
[Foo
..Foo
];