mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
fix small string handling
This commit is contained in:
parent
5fbf8f5b1c
commit
5d0947960c
1 changed files with 2 additions and 2 deletions
|
@ -780,7 +780,7 @@ impl RocRefcounted for SendSafeRocStr {
|
||||||
|
|
||||||
impl Clone for SendSafeRocStr {
|
impl Clone for SendSafeRocStr {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
if self.0.is_readonly() {
|
if self.0.is_readonly() || self.0.is_small_str() {
|
||||||
SendSafeRocStr(self.0.clone())
|
SendSafeRocStr(self.0.clone())
|
||||||
} else {
|
} else {
|
||||||
// To keep self send safe, this must copy.
|
// To keep self send safe, this must copy.
|
||||||
|
@ -851,7 +851,7 @@ impl From<RocStr> for ReadOnlyRocStr {
|
||||||
if s.is_unique() {
|
if s.is_unique() {
|
||||||
unsafe { s.set_readonly() };
|
unsafe { s.set_readonly() };
|
||||||
}
|
}
|
||||||
if s.is_readonly() {
|
if s.is_readonly() || s.is_small_str() {
|
||||||
ReadOnlyRocStr(s)
|
ReadOnlyRocStr(s)
|
||||||
} else {
|
} else {
|
||||||
// This is not readonly or unique, do a deep copy.
|
// This is not readonly or unique, do a deep copy.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue