]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: unique LinkString for renamed, embedded fields
authorMatthew Dempsky <mdempsky@google.com>
Thu, 16 Dec 2021 20:55:15 +0000 (12:55 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 13 Jan 2022 21:37:29 +0000 (21:37 +0000)
commit1a8b4e05b1ff7a52c6d40fad73bcad612168d094
tree4c6a95ef48f577300e39f24b9f00da83fb53badb
parent6891d07ee6a34f1c8d0326f3f7dd941bddf524f1
cmd/compile: unique LinkString for renamed, embedded fields

Using type aliases, it's possible to create structs with embedded
fields that have no corresponding type literal notation. However, we
still need to generate a unique name for these types to use for linker
symbols. This CL introduces a new "struct{ Name = Type }" syntax for
use in LinkString formatting to represent these types.

Reattempt at CL 372914, which was rolled back due to race-y
LocalPkg.Lookup call that isn't safe for concurrency.

Fixes #50190.

Change-Id: I0b7fd81e1b0b3199a6afcffde96ade42495ad8d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/378434
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/types/fmt.go
test/fixedbugs/issue50190.go [new file with mode: 0644]