From e35dbd29fb7ec622551861f94ecf92ca6d9724ae Mon Sep 17 00:00:00 2001 From: konimarti <30975830+konimarti@users.noreply.github.com> Date: Sat, 16 Aug 2025 03:41:59 +0200 Subject: [PATCH] string: use correct allocator in `replace` (#2405) `replace` accepts an Allocator but uses `mem` instead. --- lib/std/core/string.c3 | 2 +- releasenotes.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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`.