diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-06-25 12:47:34 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-06-28 11:53:58 -0700 |
| commit | 0dfc90ab15475aa64bea393671463a8e9784ae3f (patch) | |
| tree | 41c9c856c504f33552abe4a0eca9fbdc3d5d215d /src/libsync/deque.rs | |
| parent | 2823be08b7d1b9106cbbd454437384c093c5a5fa (diff) | |
Rename all raw pointers as necessary
Diffstat (limited to 'src/libsync/deque.rs')
| -rw-r--r-- | src/libsync/deque.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libsync/deque.rs b/src/libsync/deque.rs index 18608a0a370..cdd030ac34a 100644 --- a/src/libsync/deque.rs +++ b/src/libsync/deque.rs @@ -137,7 +137,7 @@ pub struct BufferPool<T> { /// 2. We can certainly avoid bounds checks using *T instead of Vec<T>, although /// LLVM is probably pretty good at doing this already. struct Buffer<T> { - storage: *T, + storage: *const T, log_size: uint, } @@ -354,7 +354,7 @@ impl<T: Send> Buffer<T> { let size = buffer_alloc_size::<T>(log_size); let buffer = allocate(size, min_align_of::<T>()); Buffer { - storage: buffer as *T, + storage: buffer as *const T, log_size: log_size, } } @@ -364,7 +364,9 @@ impl<T: Send> Buffer<T> { // Apparently LLVM cannot optimize (foo % (1 << bar)) into this implicitly fn mask(&self) -> int { (1 << self.log_size) - 1 } - unsafe fn elem(&self, i: int) -> *T { self.storage.offset(i & self.mask()) } + unsafe fn elem(&self, i: int) -> *const T { + self.storage.offset(i & self.mask()) + } // This does not protect against loading duplicate values of the same cell, // nor does this clear out the contents contained within. Hence, this is a @@ -610,7 +612,8 @@ mod tests { let s = s.clone(); let unique_box = box AtomicUint::new(0); let thread_box = unsafe { - *mem::transmute::<&Box<AtomicUint>, **mut AtomicUint>(&unique_box) + *mem::transmute::<&Box<AtomicUint>, + *const *mut AtomicUint>(&unique_box) }; (Thread::start(proc() { unsafe { |
