mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
rename field name
This commit is contained in:
parent
f742d50379
commit
37ef3549c8
1 changed files with 10 additions and 10 deletions
|
@ -100,7 +100,7 @@ impl RocStr {
|
||||||
heap_allocated: ManuallyDrop::new(BigString {
|
heap_allocated: ManuallyDrop::new(BigString {
|
||||||
elements: unsafe { NonNull::new_unchecked(bytes) },
|
elements: unsafe { NonNull::new_unchecked(bytes) },
|
||||||
length: len,
|
length: len,
|
||||||
capacity_or_ref_ptr: cap,
|
capacity_or_alloc_ptr: cap,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ impl RocStr {
|
||||||
};
|
};
|
||||||
|
|
||||||
big_string.length = self.len();
|
big_string.length = self.len();
|
||||||
big_string.capacity_or_ref_ptr = target_cap;
|
big_string.capacity_or_alloc_ptr = target_cap;
|
||||||
|
|
||||||
let mut updated = RocStr(RocStrInner {
|
let mut updated = RocStr(RocStrInner {
|
||||||
heap_allocated: ManuallyDrop::new(big_string),
|
heap_allocated: ManuallyDrop::new(big_string),
|
||||||
|
@ -273,7 +273,7 @@ impl RocStr {
|
||||||
let heap_allocated = ManuallyDrop::new(BigString {
|
let heap_allocated = ManuallyDrop::new(BigString {
|
||||||
elements: unsafe { NonNull::new_unchecked(ptr) },
|
elements: unsafe { NonNull::new_unchecked(ptr) },
|
||||||
length: (isize::MIN as usize) | (range.end - range.start),
|
length: (isize::MIN as usize) | (range.end - range.start),
|
||||||
capacity_or_ref_ptr: (big.ptr_to_first_elem() as usize) >> 1,
|
capacity_or_alloc_ptr: (big.ptr_to_first_elem() as usize) >> 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
Some(RocStr(RocStrInner { heap_allocated }))
|
Some(RocStr(RocStrInner { heap_allocated }))
|
||||||
|
@ -797,7 +797,7 @@ impl From<SendSafeRocStr> for RocStr {
|
||||||
struct BigString {
|
struct BigString {
|
||||||
elements: NonNull<u8>,
|
elements: NonNull<u8>,
|
||||||
length: usize,
|
length: usize,
|
||||||
capacity_or_ref_ptr: usize,
|
capacity_or_alloc_ptr: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SEAMLESS_SLICE_BIT: usize = isize::MIN as usize;
|
const SEAMLESS_SLICE_BIT: usize = isize::MIN as usize;
|
||||||
|
@ -811,7 +811,7 @@ impl BigString {
|
||||||
if self.is_seamless_slice() {
|
if self.is_seamless_slice() {
|
||||||
self.len()
|
self.len()
|
||||||
} else {
|
} else {
|
||||||
self.capacity_or_ref_ptr
|
self.capacity_or_alloc_ptr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,7 +830,7 @@ impl BigString {
|
||||||
|
|
||||||
fn ptr_to_refcount(&self) -> *mut usize {
|
fn ptr_to_refcount(&self) -> *mut usize {
|
||||||
if self.is_seamless_slice() {
|
if self.is_seamless_slice() {
|
||||||
unsafe { ((self.capacity_or_ref_ptr << 1) as *mut usize).sub(1) }
|
unsafe { ((self.capacity_or_alloc_ptr << 1) as *mut usize).sub(1) }
|
||||||
} else {
|
} else {
|
||||||
unsafe { self.ptr_to_first_elem().cast::<usize>().sub(1) }
|
unsafe { self.ptr_to_first_elem().cast::<usize>().sub(1) }
|
||||||
}
|
}
|
||||||
|
@ -909,7 +909,7 @@ impl BigString {
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
elements: NonNull::dangling(),
|
elements: NonNull::dangling(),
|
||||||
length: 0,
|
length: 0,
|
||||||
capacity_or_ref_ptr: 0,
|
capacity_or_alloc_ptr: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.reserve(cap);
|
this.reserve(cap);
|
||||||
|
@ -944,7 +944,7 @@ impl BigString {
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
elements,
|
elements,
|
||||||
length: self.len(),
|
length: self.len(),
|
||||||
capacity_or_ref_ptr: desired_cap,
|
capacity_or_alloc_ptr: desired_cap,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::mem::swap(&mut this, self);
|
std::mem::swap(&mut this, self);
|
||||||
|
@ -961,7 +961,7 @@ impl BigString {
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
elements,
|
elements,
|
||||||
length: self.len(),
|
length: self.len(),
|
||||||
capacity_or_ref_ptr: desired_cap,
|
capacity_or_alloc_ptr: desired_cap,
|
||||||
};
|
};
|
||||||
|
|
||||||
std::mem::swap(&mut this, self);
|
std::mem::swap(&mut this, self);
|
||||||
|
@ -975,7 +975,7 @@ impl Clone for BigString {
|
||||||
let mut this = Self {
|
let mut this = Self {
|
||||||
elements: self.elements,
|
elements: self.elements,
|
||||||
length: self.length,
|
length: self.length,
|
||||||
capacity_or_ref_ptr: self.capacity_or_ref_ptr,
|
capacity_or_alloc_ptr: self.capacity_or_alloc_ptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.inc(1);
|
this.inc(1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue