sync/channels: use references for `chan mut X` testcase (#6145)

pull/6152/head
Uwe Krüger 2020-08-16 23:01:49 +02:00 committed by GitHub
parent 2aedece23d
commit 0c7d73c8b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -6,12 +6,16 @@ const (
struct St {
mut:
n int
dummy i64
dummy2 u32
dummy3 i64
n int
dummy4 int
}
// this function gets an array of channels for `St` references
fn do_rec_calc_send(chs []chan mut St) {
mut s := St{}
mut s := &St(0)
for {
if !(&sync.Channel(chs[0])).pop(&s) {
break
@ -24,7 +28,7 @@ fn do_rec_calc_send(chs []chan mut St) {
fn test_channel_array_mut() {
mut chs := [chan mut St{cap: 1}, chan mut St{}]
go do_rec_calc_send(chs)
mut t := St{
mut t := &St{
n: 100
}
for _ in 0 .. num_iterations {