compiler: mark stringFromBytes as nocapture/readonly to help escape analysis

Fixes #4525
This commit is contained in:
Damian Gryski
2024-10-18 08:00:42 -07:00
committed by Ron Evans
parent 01dac8ba8e
commit 40c9c66c1d
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -49,6 +49,11 @@ func main() {
n4 = n5
}()
println(n4, n5)
// This shouldn't escape.
var buf [32]byte
s := string(buf[:])
println(len(s))
}
func derefInt(x *int) int {