Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit db93bf6

Browse files
authored
Merge pull request #20 from Freax13/master
updates uses of Unique
2 parents 729c972 + 6e8da5d commit db93bf6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/raw_vec.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<T, A: AllocRef> RawVec<T, A> {
129129
pub const fn new_in(alloc: A) -> Self {
130130
// `cap: 0` means "unallocated". zero-sized types are ignored.
131131
Self {
132-
ptr: Unique::empty(),
132+
ptr: Unique::dangling(),
133133
cap: 0,
134134
alloc,
135135
}
@@ -182,7 +182,7 @@ impl<T, A: AllocRef> RawVec<T, A> {
182182
.alloc(layout, init)
183183
.map_err(|_| AllocError { layout })?;
184184
Ok(Self {
185-
ptr: memory.ptr.cast().into(),
185+
ptr: Unique::new(memory.ptr.cast().as_ptr()).unwrap(),
186186
cap: Self::capacity_from_bytes(memory.size),
187187
alloc,
188188
})
@@ -541,7 +541,7 @@ impl<T, A: AllocRef> RawVec<T, A> {
541541
}
542542

543543
fn set_memory(&mut self, memory: MemoryBlock) {
544-
self.ptr = memory.ptr.cast().into();
544+
self.ptr = Unique::new(memory.ptr.cast().as_ptr()).unwrap();
545545
self.cap = Self::capacity_from_bytes(memory.size);
546546
}
547547

0 commit comments

Comments
 (0)