From: Cuong Manh Le Date: Thu, 12 Sep 2019 16:23:10 +0000 (+0700) Subject: cmd/compile: do not mark export for send only chan X-Git-Tag: go1.14beta1~1108 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=48e482ef0c23032affce7998e985dee6fcda14bc;p=gostls13.git cmd/compile: do not mark export for send only chan No changes in compilebench, pass toolstash-check. Change-Id: I2688f7b45af0eaa0cf3b38e726bce6e68c20f69c Reviewed-on: https://go-review.googlesource.com/c/go/+/195077 Run-TryBot: Cuong Manh Le Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/internal/gc/bexport.go b/src/cmd/compile/internal/gc/bexport.go index 7c09ab5a34..e67506f4e1 100644 --- a/src/cmd/compile/internal/gc/bexport.go +++ b/src/cmd/compile/internal/gc/bexport.go @@ -43,11 +43,14 @@ func (p *exporter) markType(t *types.Type) { // the user already needs some way to construct values of // those types. switch t.Etype { - case TPTR, TARRAY, TSLICE, TCHAN: - // TODO(mdempsky): Skip marking element type for - // send-only channels? + case TPTR, TARRAY, TSLICE: p.markType(t.Elem()) + case TCHAN: + if t.ChanDir().CanRecv() { + p.markType(t.Elem()) + } + case TMAP: p.markType(t.Key()) p.markType(t.Elem())