@@ -200,9 +200,8 @@ use cmp::Ordering;
200
200
use fmt:: { self , Debug , Display } ;
201
201
use marker:: Unsize ;
202
202
use mem;
203
- use ops:: { Deref , DerefMut , CoerceUnsized , Index } ;
203
+ use ops:: { Deref , DerefMut , CoerceUnsized } ;
204
204
use ptr;
205
- use slice:: SliceIndex ;
206
205
207
206
/// A mutable memory location.
208
207
///
@@ -510,8 +509,9 @@ impl<T: ?Sized> Cell<T> {
510
509
/// use std::cell::Cell;
511
510
/// let slice: &mut [i32] = &mut [1,2,3];
512
511
/// let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
512
+ /// assert_eq!(cell_slice.len(), 3);
513
513
/// let slice_cell : &[Cell<i32>] = &cell_slice[..];
514
- /// assert_eq!(slice_cell.len(), 3)
514
+ /// assert_eq!(slice_cell.len(), 3);
515
515
/// ```
516
516
#[ inline]
517
517
#[ unstable( feature = "as_cell" , issue="43038" ) ]
@@ -546,15 +546,13 @@ impl<T: Default> Cell<T> {
546
546
impl < T : CoerceUnsized < U > , U > CoerceUnsized < Cell < U > > for Cell < T > { }
547
547
548
548
#[ unstable( feature = "as_cell" , issue="43038" ) ]
549
- impl < T , I > Index < I > for Cell < [ T ] >
550
- where
551
- I : SliceIndex < [ Cell < T > ] >
552
- {
553
- type Output = I :: Output ;
549
+ impl < T > Deref for Cell < [ T ] > {
550
+ type Target = [ Cell < T > ] ;
554
551
555
- fn index ( & self , index : I ) -> & Self :: Output {
552
+ #[ inline]
553
+ fn deref ( & self ) -> & [ Cell < T > ] {
556
554
unsafe {
557
- Index :: index ( & * ( self as * const Cell < [ T ] > as * const [ Cell < T > ] ) , index )
555
+ & * ( self as * const Cell < [ T ] > as * const [ Cell < T > ] )
558
556
}
559
557
}
560
558
}
0 commit comments