@@ -84,8 +84,8 @@ impl<T> fmt::Debug for PtrKind<T> {
8484 PtrKind :: HeapSingle ( w) => write ! ( f, "HeapSingle({:?})" , w. as_ptr( ) ) ,
8585 PtrKind :: StackArray ( w) => write ! ( f, "StackArray({:?})" , w. as_ptr( ) ) ,
8686 PtrKind :: HeapArray ( w) => write ! ( f, "HeapArray({:?})" , w. as_ptr( ) ) ,
87- PtrKind :: Reinterpreted ( view ) => {
88- write ! ( f, "Reinterpreted(0x{:x})" , view . alloc. address( ) )
87+ PtrKind :: Reinterpreted ( data ) => {
88+ write ! ( f, "Reinterpreted(0x{:x})" , data . alloc. address( ) )
8989 }
9090 }
9191 }
@@ -100,7 +100,7 @@ impl<T> Clone for PtrKind<T> {
100100 PtrKind :: HeapSingle ( weak) => PtrKind :: HeapSingle ( weak. clone ( ) ) ,
101101 PtrKind :: StackArray ( weak) => PtrKind :: StackArray ( weak. clone ( ) ) ,
102102 PtrKind :: HeapArray ( weak) => PtrKind :: HeapArray ( weak. clone ( ) ) ,
103- PtrKind :: Reinterpreted ( view ) => PtrKind :: Reinterpreted ( Rc :: clone ( view ) ) ,
103+ PtrKind :: Reinterpreted ( data ) => PtrKind :: Reinterpreted ( Rc :: clone ( data ) ) ,
104104 }
105105 }
106106}
@@ -112,7 +112,7 @@ impl<T> PtrKind<T> {
112112 PtrKind :: StackSingle ( w) | PtrKind :: HeapSingle ( w) => w. as_ptr ( ) as usize ,
113113 PtrKind :: Vec ( w) => w. as_ptr ( ) as usize ,
114114 PtrKind :: StackArray ( w) | PtrKind :: HeapArray ( w) => w. as_ptr ( ) as usize ,
115- PtrKind :: Reinterpreted ( view ) => view . alloc . address ( ) ,
115+ PtrKind :: Reinterpreted ( data ) => data . alloc . address ( ) ,
116116 }
117117 }
118118}
@@ -258,7 +258,7 @@ impl<T> Ptr<T> {
258258 #[ inline]
259259 fn elem_step ( & self ) -> usize {
260260 match & self . kind {
261- PtrKind :: Reinterpreted ( view ) => view . elem_byte_size ,
261+ PtrKind :: Reinterpreted ( data ) => data . elem_byte_size ,
262262 _ => 1 ,
263263 }
264264 }
@@ -272,7 +272,7 @@ impl<T> Ptr<T> {
272272 PtrKind :: StackArray ( weak) | PtrKind :: HeapArray ( weak) => {
273273 weak. upgrade ( ) . expect ( "ub: dangling pointer" ) . borrow ( ) . len ( )
274274 }
275- PtrKind :: Reinterpreted ( view ) => view . alloc . total_byte_len ( ) / view . elem_byte_size ,
275+ PtrKind :: Reinterpreted ( data ) => data . alloc . total_byte_len ( ) / data . elem_byte_size ,
276276 }
277277 }
278278
@@ -291,7 +291,7 @@ impl<T> Ptr<T> {
291291 . expect ( "ub: dangling pointer" )
292292 . borrow ( )
293293 . is_empty ( ) ,
294- PtrKind :: Reinterpreted ( view ) => self . offset >= view . alloc . total_byte_len ( ) ,
294+ PtrKind :: Reinterpreted ( data ) => self . offset >= data . alloc . total_byte_len ( ) ,
295295 }
296296 }
297297
@@ -346,8 +346,8 @@ impl<T> Ptr<T> {
346346 rc : weak. upgrade ( ) . expect ( "ub: dangling pointer" ) ,
347347 offset : self . offset ,
348348 } ,
349- PtrKind :: Reinterpreted ( view ) => StrongPtr :: Reinterpreted {
350- alloc : Rc :: clone ( & view . alloc ) ,
349+ PtrKind :: Reinterpreted ( data ) => StrongPtr :: Reinterpreted {
350+ alloc : Rc :: clone ( & data . alloc ) ,
351351 byte_offset : self . offset ,
352352 cell : RefCell :: new ( None ) ,
353353 } ,
@@ -372,10 +372,10 @@ impl<T> Ptr<T> {
372372 let rc = weak. upgrade ( ) . expect ( "ub: dangling pointer" ) ;
373373 rc. borrow_mut ( ) [ self . offset ] = value;
374374 }
375- PtrKind :: Reinterpreted ( view ) => {
375+ PtrKind :: Reinterpreted ( data ) => {
376376 let mut buf = vec ! [ 0u8 ; T :: byte_size( ) ] ;
377377 value. to_bytes ( & mut buf) ;
378- view . alloc . write_bytes ( self . offset , & buf) ;
378+ data . alloc . write_bytes ( self . offset , & buf) ;
379379 }
380380 }
381381 }
@@ -417,7 +417,7 @@ impl<T> Ptr<T> {
417417 Rc :: new ( SliceOriginalAlloc { weak : weak. clone ( ) } ) ,
418418 src_byte_off,
419419 ) ,
420- PtrKind :: Reinterpreted ( view ) => ( Rc :: clone ( & view . alloc ) , self . offset ) ,
420+ PtrKind :: Reinterpreted ( data ) => ( Rc :: clone ( & data . alloc ) , self . offset ) ,
421421 } ;
422422
423423 Ptr {
@@ -452,13 +452,13 @@ impl<T> Ptr<T> {
452452 let mut borrow = rc. borrow_mut ( ) ;
453453 f ( & mut borrow[ self . offset ] )
454454 }
455- PtrKind :: Reinterpreted ( view ) => {
455+ PtrKind :: Reinterpreted ( data ) => {
456456 let mut buf = vec ! [ 0u8 ; T :: byte_size( ) ] ;
457- view . alloc . read_bytes ( self . offset , & mut buf) ;
457+ data . alloc . read_bytes ( self . offset , & mut buf) ;
458458 let mut val = T :: from_bytes ( & buf) ;
459459 let ret = f ( & mut val) ;
460460 val. to_bytes ( & mut buf) ;
461- view . alloc . write_bytes ( self . offset , & buf) ;
461+ data . alloc . write_bytes ( self . offset , & buf) ;
462462 ret
463463 }
464464 }
@@ -485,9 +485,9 @@ impl<T> Ptr<T> {
485485 let borrow = rc. borrow ( ) ;
486486 f ( & borrow[ self . offset ] )
487487 }
488- PtrKind :: Reinterpreted ( view ) => {
488+ PtrKind :: Reinterpreted ( data ) => {
489489 let mut buf = vec ! [ 0u8 ; T :: byte_size( ) ] ;
490- view . alloc . read_bytes ( self . offset , & mut buf) ;
490+ data . alloc . read_bytes ( self . offset , & mut buf) ;
491491 let val = T :: from_bytes ( & buf) ;
492492 f ( & val)
493493 }
@@ -512,9 +512,9 @@ impl<T: Clone + ByteRepr> Ptr<T> {
512512 PtrKind :: StackArray ( ref weak) | PtrKind :: HeapArray ( ref weak) => {
513513 weak. upgrade ( ) . expect ( "ub: dangling pointer" ) . borrow ( ) [ self . offset ] . clone ( )
514514 }
515- PtrKind :: Reinterpreted ( ref view ) => {
515+ PtrKind :: Reinterpreted ( ref data ) => {
516516 let mut buf = vec ! [ 0u8 ; T :: byte_size( ) ] ;
517- view . alloc . read_bytes ( self . offset , & mut buf) ;
517+ data . alloc . read_bytes ( self . offset , & mut buf) ;
518518 T :: from_bytes ( & buf)
519519 }
520520 }
@@ -909,7 +909,7 @@ impl<T> fmt::Debug for Ptr<T> {
909909 ( Weak :: as_ptr ( w) as usize ) . wrapping_add ( self . byte_offset ( ) )
910910 }
911911 PtrKind :: Vec ( w) => ( Weak :: as_ptr ( w) as usize ) . wrapping_add ( self . byte_offset ( ) ) ,
912- PtrKind :: Reinterpreted ( view ) => view . alloc . address ( ) . wrapping_add ( self . byte_offset ( ) ) ,
912+ PtrKind :: Reinterpreted ( data ) => data . alloc . address ( ) . wrapping_add ( self . byte_offset ( ) ) ,
913913 } ;
914914 write ! ( f, "0x{:x}" , addr)
915915 }
@@ -1005,9 +1005,9 @@ impl Ptr<u8> {
10051005 let raw = strong. borrow ( ) ;
10061006 raw[ start..end] . to_vec ( )
10071007 }
1008- PtrKind :: Reinterpreted ( ref view ) => {
1008+ PtrKind :: Reinterpreted ( ref data ) => {
10091009 let mut buf = vec ! [ 0u8 ; end. wrapping_sub( start) ] ;
1010- view . alloc . read_bytes ( start, & mut buf) ;
1010+ data . alloc . read_bytes ( start, & mut buf) ;
10111011 buf
10121012 }
10131013 }
0 commit comments