diff --git a/vlib/builtin/rune.v b/vlib/builtin/rune.v index 0f78a11412..bc2a9ba7e4 100644 --- a/vlib/builtin/rune.v +++ b/vlib/builtin/rune.v @@ -2,6 +2,8 @@ // Use of this source code is governed by an MIT license that can be found in the LICENSE file. module builtin +import strings + // This was never working correctly, the issue is now // fixed however the type checks in checker need to be // updated. if you uncomment it you will see the issue @@ -29,11 +31,14 @@ pub fn (c rune) str() string { } // string converts a rune array to a string +[manualfree] pub fn (ra []rune) string() string { - mut res := '' + mut sb := strings.new_builder(ra.len) for r in ra { - res += r.str() + sb.write_string(r.str()) } + res := sb.str() + unsafe { sb.free() } return res }