Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The documentation of b.Loop mentions that the compiler has a special case for it, and it "must be written in exactly" the form of "for b.Loop() { ... }". Turns out it's actually not that restrictive. As of Go 1.24, the check is at https://github.com/golang/go/blob/master/src/cmd/compile/internal/inline/interleaved/interleaved.go. It has no restrictions on the init and post part of the for loop. Given this knowledge, this commit moves scattered "var i int" and "i++" into the for statement.
- Loading branch information