Skip to content

Commit e35dbd2

Browse files
authored
string: use correct allocator in replace (#2405)
`replace` accepts an Allocator but uses `mem` instead.
1 parent b52ab88 commit e35dbd2

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/std/core/string.c3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn String String.replace(self, Allocator allocator, String needle, String new_st
187187
@pool()
188188
{
189189
String[] split = self.tsplit(needle);
190-
return dstring::join(tmem, split, new_str).copy_str(mem);
190+
return dstring::join(tmem, split, new_str).copy_str(allocator);
191191
};
192192
}
193193

releasenotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- Slicing a constant array with designated initialization would not update the indexes.
4040
- Fix for bug when `@format` encountered `*` in some cases.
4141
- Compiler segfault on global slice initialization with null[:0] #2404.
42+
- Use correct allocator in `replace`.
4243

4344
### Stdlib changes
4445
- Add `==` to `Pair`, `Triple` and TzDateTime. Add print to `Pair` and `Triple`.

0 commit comments

Comments
 (0)