diff --git a/lib/std/core/string.c3 b/lib/std/core/string.c3 index 78ecbfc29..62e142af5 100644 --- a/lib/std/core/string.c3 +++ b/lib/std/core/string.c3 @@ -187,7 +187,7 @@ fn String String.replace(self, Allocator allocator, String needle, String new_st @pool() { String[] split = self.tsplit(needle); - return dstring::join(tmem, split, new_str).copy_str(mem); + return dstring::join(tmem, split, new_str).copy_str(allocator); }; } diff --git a/releasenotes.md b/releasenotes.md index fe76295d1..b6ce7aa35 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -39,6 +39,7 @@ - Slicing a constant array with designated initialization would not update the indexes. - Fix for bug when `@format` encountered `*` in some cases. - Compiler segfault on global slice initialization with null[:0] #2404. +- Use correct allocator in `replace`. ### Stdlib changes - Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.