@@ -200,9 +200,8 @@ use cmp::Ordering;
200200use fmt:: { self , Debug , Display } ;
201201use marker:: Unsize ;
202202use mem;
203- use ops:: { Deref , DerefMut , CoerceUnsized , Index } ;
203+ use ops:: { Deref , DerefMut , CoerceUnsized } ;
204204use ptr;
205- use slice:: SliceIndex ;
206205
207206/// A mutable memory location.
208207///
@@ -510,8 +509,9 @@ impl<T: ?Sized> Cell<T> {
510509 /// use std::cell::Cell;
511510 /// let slice: &mut [i32] = &mut [1,2,3];
512511 /// let cell_slice: &Cell<[i32]> = Cell::from_mut(slice);
512+ /// assert_eq!(cell_slice.len(), 3);
513513 /// let slice_cell : &[Cell<i32>] = &cell_slice[..];
514- /// assert_eq!(slice_cell.len(), 3)
514+ /// assert_eq!(slice_cell.len(), 3);
515515 /// ```
516516 #[ inline]
517517 #[ unstable( feature = "as_cell" , issue="43038" ) ]
@@ -546,15 +546,13 @@ impl<T: Default> Cell<T> {
546546impl < T : CoerceUnsized < U > , U > CoerceUnsized < Cell < U > > for Cell < T > { }
547547
548548#[ 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 > ] ;
554551
555- fn index ( & self , index : I ) -> & Self :: Output {
552+ #[ inline]
553+ fn deref ( & self ) -> & [ Cell < T > ] {
556554 unsafe {
557- Index :: index ( & * ( self as * const Cell < [ T ] > as * const [ Cell < T > ] ) , index )
555+ & * ( self as * const Cell < [ T ] > as * const [ Cell < T > ] )
558556 }
559557 }
560558}
0 commit comments