mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +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 {
|
||||
fn clone(&self) -> Self {
|
||||
if self.0.is_readonly() {
|
||||
if self.0.is_readonly() || self.0.is_small_str() {
|
||||
SendSafeRocStr(self.0.clone())
|
||||
} else {
|
||||
// To keep self send safe, this must copy.
|
||||
|
@ -851,7 +851,7 @@ impl From<RocStr> for ReadOnlyRocStr {
|
|||
if s.is_unique() {
|
||||
unsafe { s.set_readonly() };
|
||||
}
|
||||
if s.is_readonly() {
|
||||
if s.is_readonly() || s.is_small_str() {
|
||||
ReadOnlyRocStr(s)
|
||||
} else {
|
||||
// This is not readonly or unique, do a deep copy.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue