1
0
mirror of https://github.com/golang/go synced 2024-11-17 13:54:46 -07:00
Commit Graph

50830 Commits

Author SHA1 Message Date
Austin Clements
08ecdf7c2e runtime: fix racy allgs access on weak memory architectures
Currently, markroot is very clever about accessing the allgs slice to
find stack roots. Unfortunately, on weak memory architectures, it's a
little too clever and can sometimes read a nil g, causing a fatal
panic.

Specifically, gcMarkRootPrepare snapshots the length of allgs during
STW and then markroot accesses allgs up to this length during
concurrent marking. During concurrent marking, allgadd can append to
allgs *without synchronizing with markroot*, but the argument is that
the markroot access should be safe because allgs only grows
monotonically and existing entries in allgs never change.

This reasoning is insufficient on weak memory architectures. Suppose
thread 1 calls allgadd during concurrent marking and that allgs is
already at capacity. On thread 1, append will allocate a new slice
that initially consists of all nils, then copy the old backing store
to the new slice (write A), then allgadd will publish the new slice to
the allgs global (write B). Meanwhile, on thread 2, markroot reads the
allgs slice base pointer (read A), computes an offset from that base
pointer, and reads the value at that offset (read B). On a weak memory
machine, thread 2 can observe write B *before* write A. If the order
of events from thread 2's perspective is write B, read A, read B,
write A, then markroot on thread 2 will read a nil g and then panic.

Fix this by taking a snapshot of the allgs slice header in
gcMarkRootPrepare while the world is stopped and using that snapshot
as the list of stack roots in markroot. This eliminates all read/write
concurrency around the access in markroot.

Alternatively, we could make markroot use the atomicAllGs API to
atomically access the allgs list, but in my opinion it's much less
subtle to just eliminate all of the interesting concurrency around the
allgs access.

Fixes #49686.
Fixes #48845.
Fixes #43824.
(These are all just different paths to the same ultimate issue.)

Change-Id: I472b4934a637bbe88c8a080a280aa30212acf984
Reviewed-on: https://go-review.googlesource.com/c/go/+/368134
Trust: Austin Clements <austin@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-12-01 17:13:34 +00:00
Bryan C. Mills
8ebb8c9ecb runtime: give the subprocess more time in TestSpuriousWakeupsNeverHangSemasleep
Issue #27250 reproduced readily enough to keep the subprocess hung
indefinitely when it occurred, so the timeout does not need to be
short to maintain test fidelity. On the other hand, on heavily loaded
systems it might take a while for the kernel to actually start the
subprocess, and it might also take a while for control flow to return
to the test after the subprocess exits.

We can reduce noise from this test in two ways:

1. Measure the timeout from closer to when the subprocess actually
starts sleeping, instead of when we started creating the subprocess.

2. Use a longer timeout, since it doesn't actually need to be short.

Fixes #38921
Updates #27250

Change-Id: I01c11ae82d0cdc6e7def2da6544b4d07201b35e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/367849
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-12-01 17:01:41 +00:00
Rhys Hiltner
2c5d2083e4 runtime: fix riscv64 sigaction mask field offset
The Linux kernel for riscv64 does not include an sa_restorer field on
its sigaction struct, and expects sa_mask to come immediately after the
sa_flags field. Arrange the fields of the sigaction struct that are
known to the kernel so they appear at the correct byte offsets, and so
they agree with the output of "go tool cgo -godefs".

Follow the example set by the mips/mipsle port to leave the sa_restorer
field in place, but at an offset where it won't hurt anything.

Fixes #49709

Change-Id: I9bb0d7dbd7439d07e3a204461c7d790f33fd4977
Reviewed-on: https://go-review.googlesource.com/c/go/+/367635
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Trust: Ian Lance Taylor <iant@golang.org>
2021-12-01 16:55:04 +00:00
Cherry Mui
029dfbcc83 net: do not use sendfile on iOS
Apparently, on the iOS builder sendfile causes a SIGSYS signal
(instead of returning ENOSYS). Disabling it for now so we can
make progress on iOS. We can revisit if sendfile is actually
broken on iOS and whether it is beneficial.

Updates #49616.

Change-Id: I3883fad0ce35e3f0aa352301eb499a1afa0225a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/368054
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Changkun Ou <mail@changkun.de>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-12-01 15:58:46 +00:00
Bryan C. Mills
ab7905540b cmd/go/internal/modload: fix up main-module checks from CL 334932
Some critical Version == "" checks were missing in mvs.go, causing
mvs.Req to fail to retain requirements provided by older versions of
main modules.

A few checks also ought to be rotated to put the less expensive
string-equality checks before the more expensive map lookups.

Fixes #48511

Change-Id: Ib8de9d49a6413660792c003866bfcf9ab7f82ee2
Reviewed-on: https://go-review.googlesource.com/c/go/+/368136
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-12-01 15:43:08 +00:00
Cuong Manh Le
0e1d553b4d cmd/compile: fix identical to recognize any and interface{}
Currently, identical handles any and interface{} by checking against
Types[TINTER]. This is not always true, since when two generated
interface{} types may not use the same *Type instance.

Instead, we must check whether Type is empty interface or not.

Fixes #49875

Change-Id: I28fe4fc0100041a01bb03da795cfe8232b515fc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/367754
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-12-01 10:19:34 +00:00
Tobias Klauser
a412b5f0d8 runtime: skip TestSignalIgnoreSIGTRAP on all OpenBSD builders
TestSignalIgnoreSIGTRAP is flaky on OpenBSD and the cause is suspected
to be a kernel bug. This test is currently only skipped on the previous
OpenBSD 6.2 and 6.4 builders for #17496. In the meantime the OpenBSD
builders were upgraded to more recent OpenBSD versions (currently 6.8
and 7.0). It seems the issue is still present in these OpenBSD versions
and there is no obvious workaround in Go. Thus, skip the flaky test on
OpenBSD in general.

Updates #17496
Updates #49725

Change-Id: I3577d287dcfaad7a81679db2e71540854fce065a
Reviewed-on: https://go-review.googlesource.com/c/go/+/367115
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-12-01 06:03:27 +00:00
Paul E. Murphy
7ccbcc9056 misc/cgo/test: further reduce likeliness of hang in Test9400
As suggested by #49680, a GC could be in-progress when we
disable GC. Force a GC after we pause to ensure we don't
hang in this case.

For #49695

Change-Id: I4fc4c06ef2ac174217c3dcf7d58c7669226e2d24
Reviewed-on: https://go-review.googlesource.com/c/go/+/367874
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Paul Murphy <murp@ibm.com>
2021-11-30 20:04:58 +00:00
Chaoqun Han
5f63f168da runtime: add invalidptr=0 for TestGcZombieReporting
pointers in zombies slice may cross-span, add invalidptr=0 for avoiding the badPointer check

Fixes #49613

Change-Id: Ifb1931922170e87e799e2e6081dc85dab3890205
Reviewed-on: https://go-review.googlesource.com/c/go/+/367044
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-30 18:49:39 +00:00
Russ Cox
931d80ec17 cmd/go: adjust BuildInfo.Settings
Make Settings more closely align with command-line flags
and environment variables.

- Change command-line flags to begin with -

- Change syntax of build lines to use Key=Value instead of Key<tab>Value.

- Change CGO_ENABLED to 0/1, matching environment variable,
  instead of false/true.

- Add GOOS and GOARCH.
  These are technically redundant, in that they can be extracted
  from the binary in other ways most of the time, but not always:
  GOOS=ios and GOOS=darwin may produce binaries that are
  difficult to tell apart. In any case, it's a lot easier to have them
  directly in the settings list than derive them from other parts
  of the binary.

- Add GOEXPERIMENT.
  These could be inferred from the tags list, but the experiments
  are being removed from the tags list.

- Change the tags list to match the -tags command-line argument.

- Add msan and race, echoing the -msan and -race arguments
  (always 'true' when present, omitted when false).

- Add GO$GOARCH when set.

Change-Id: Icb59ef4faa5c22407eadd94147b7e53cf4344ce6
Reviewed-on: https://go-review.googlesource.com/c/go/+/358539
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-30 18:09:02 +00:00
Paul E. Murphy
682435dd99 misc/cgo/test: reduce likeliness of hang in Test9400
If a GC triggers while spinning in RewindAndSetgid, it may result in
this test hanging. Avoid it by disabling the collector before entering
the uninterruptable ASM conditional wait.

Fixes #49695

Change-Id: Ie0a03653481fb746f862469361b7840f4bfa8b67
Reviewed-on: https://go-review.googlesource.com/c/go/+/365836
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-30 15:28:46 +00:00
Bryan C. Mills
18934e11ba net/http: eliminate arbitrary timeout in TestClientWriteShutdown
This test occasionally hangs on the darwin-arm64-11_0-toothrot
builder. When it does, it fails with the unhelpful error message
"timeout" instead of a useful goroutine dump.

This change eliminates the use of an arbitrary timeout channel, so
that if (and probably when) the test hangs again we will get more
useful logs to diagnose the root cause.

For #49860

Change-Id: I23f6f1c81209f0b2dbe565e1dfb26b1b2eff0187
Reviewed-on: https://go-review.googlesource.com/c/go/+/367615
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-11-30 03:39:57 +00:00
Jason A. Donenfeld
f463b20789 runtime: keep //go:cgo_unsafe_args arguments alive to prevent GC
When syscall's DLL.FindProc calls into syscall_getprocaddress with a
byte slice pointer, we need to keep those bytes alive. Otherwise the GC
will collect the allocation, and we wind up calling `GetProcAddress` on
garbage, which showed up as various flakes in the builders. It turns out
that this problem extends to many uses of //go:cgo_unsafe_args
throughout, on all platforms. So this patch fixes the issue by keeping
non-integer pointer arguments alive through their invocation in
//go:cgo_unsafe_args functions.

Fixes #49731.

Change-Id: I93e4fbc2e8e210cb3fc53149708758bb33f2f9c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/367654
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-30 03:11:18 +00:00
Dan Scales
f90a42b410 cmd/compile: change iexportVersionGeneric to 2
Don't expect/allow generics-related info in iexportVersion 1, now that
we increased the export version to 2.

Fixes #49853

Change-Id: I9bacee7f8e7cb9bb3b02a00084fad77edd220121
Reviewed-on: https://go-review.googlesource.com/c/go/+/367634
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-11-30 01:25:55 +00:00
Robert Findley
3ca57c7fb8 go/types, types2: handle case of no specific target types in conversion
Avoid a panic by handling the case of no specific target type in a type
parameter to type parameter conversions.

Fixes #49864

Change-Id: I117dd80cc9d47c8c1e168f1caf0f281726270c84
Reviewed-on: https://go-review.googlesource.com/c/go/+/367616
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-29 22:57:42 +00:00
Robert Findley
186f375ecf go/types: ensure that constructed type parameters are immutable
TypeParam.iface may mutate TypeParam.bound in the event that the type
parameter bound is not an interface.

Ensure that iface() is called before the type-checking pass returns, and
before NewTypeParam or TypeParam.SetConstraint exits.

Fixes #49788

Change-Id: I72279acf5f0223161671c04887bc2c3df4158927
Reviewed-on: https://go-review.googlesource.com/c/go/+/367614
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-29 22:25:04 +00:00
Robert Findley
c402d64f37 go/types: consider structural restrictions in Implements
Fixes #49786

Change-Id: I4559d013399deda48bcb97aef3427ecf87a3ef26
Reviewed-on: https://go-review.googlesource.com/c/go/+/367515
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-29 22:24:47 +00:00
Robert Griesemer
ebd0b778c9 go/types: better error message for missing ~ in constraint
This is a port of CL 366758 from types2 to go/types.

For #49179.

Change-Id: I7e1c6ffb392d5c535cf901004b7acbe8c3be9b0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/367199
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-29 22:02:51 +00:00
Robert Griesemer
bc32dd1b69 go/types: better error position for instantiation failure
This is a port of CL 366757 from types2 to go/types,
adjusted for the different handling of index expressions
in go/types.

For #49179.

Change-Id: Ic859eb09683134d055e28c8e0cb1f3814a87dc5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/367198
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-29 22:02:50 +00:00
Robert Griesemer
1ab677a797 go/types: produce empty type set for invalid ~T
This is a clean port of CL 366278 from types2 to go/types.

For #49739.

Change-Id: I2e2cb739c02fcc07e012499c7b65b13b057875ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/367197
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-29 22:02:49 +00:00
Robert Griesemer
2f6d382050 go/types: report types for mismatched call and return statements
This is a port of CL 364874 from types2 to go/types with various
adjustments:

- the error position for "not enough arguments" in calls is the
  closing ) rather than the position of the last provided argument

- the ERROR comments in tests are positioned accordingly

- the reg. expression for matching error strings accepts newlines
  for the . pattern (added s flag)

For #48834.
For #48835.

Change-Id: I64362ecf605bcf9d89b8dc121432e0131bd5da1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/367196
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-29 22:02:48 +00:00
Robert Griesemer
1970e3e3b7 go/types: restore original assignment error messages
This is the missing portion of the port of CL 351669
from types2 to go/types, now that we have a local flag
to control for compiler error messages.

Mostly a clean port but for adjustments to error reporting
which requires error codes in go/types.

Prerequisite for port of CL 364874.

Change-Id: I5fc8c83003e4396351f42e9adb08f4ebc8a05653
Reviewed-on: https://go-review.googlesource.com/c/go/+/367195
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-29 22:02:45 +00:00
Austin Clements
f598e2962d runtime: fix preemption sensitivity in TestTinyAllocIssue37262
TestTinyAllocIssue37262 assumes that all of its allocations will come
from the same tiny allocator (that is, the same P), and that nothing
else will allocate from that tiny allocator while it's running. It can
fail incorrectly if these assumptions aren't met.

Fix this potential test flakiness by disabling preemption during this
test.

As far as I know, this has never happened on the builders. It was
found by mayMoreStackPreempt.

Change-Id: I59f993e0bdbf46a9add842d0e278415422c3f804
Reviewed-on: https://go-review.googlesource.com/c/go/+/366994
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-11-29 19:45:58 +00:00
Robert Griesemer
61ff501968 spec: adjust section on package unsafe for type parameters
Change-Id: I562d4648756e710020ee491f3801896563a89baa
Reviewed-on: https://go-review.googlesource.com/c/go/+/367395
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-29 19:24:41 +00:00
Robert Griesemer
68da368a4e spec: rules for index expressions, len, cap, with type parameter types
We want to support some special cases for index expressions, len, and
cap on operands of type parameters (such as indexing a value constrained
by byte slices and strings), hence the extra rules.

Change-Id: I4a07dc7e64bb47361b021d606c52eae1784d5430
Reviewed-on: https://go-review.googlesource.com/c/go/+/366814
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-29 19:24:34 +00:00
Robert Griesemer
37a5d720d4 spec: corrections to various sections
- fix definition of "specific types" and add more examples
- state that a parameterized function must be instantiated
  when used as a function value
- remove duplicate word ("can can" -> "can")

Thanks to @danscales for finding these.

Change-Id: Ideb41efc35a3e67694d3bc97e462454feae37c44
Reviewed-on: https://go-review.googlesource.com/c/go/+/367394
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-29 19:24:26 +00:00
Ian Lance Taylor
4325c37d67 vendor: update golang.org/x/net to tip
This brings in a fix for OpenBSD that lets it correctly gather network
interface information.

For #42064

Change-Id: Ib88fd2f494bb2ee86fd2725d8375b2df1404c4ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/366756
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-29 19:21:29 +00:00
Jason A. Donenfeld
a59ab29bf2 doc/go1.18: use <code> instead of <pre> for target specification
For #47694.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Change-Id: I38c2fd9b57fbbacf220a2bc679f67e2dfdcc7cb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367514
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-29 16:08:23 +00:00
Meng Zhuo
1ea4d3b911 cmd/link: merge note sections into one segment
The ld from binutils merges note sections into one PT_NOTE
segment.
We should do that for consistency with binutils.

Change-Id: I45703525c720972d49c36c4f10ac47d1628b5698
Reviewed-on: https://go-review.googlesource.com/c/go/+/265957
Trust: Meng Zhuo <mzh@golangcn.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-29 00:58:50 +00:00
Bharath Kumar Uppala
78af02e8b5 A+C: add Bharath Kumar Uppala (individual CLA)
Change-Id: I4943e943892bd29bca2afafddb62f3060bc153e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/367074
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
2021-11-29 00:57:09 +00:00
syumai
0fa53e41f1 spec: fix link for instantiations
This change corrects the link `Instantiantions` to `Instantiations` in the spec.

Change-Id: Ib0ed03420ae401d20af1ea723c5487018b2f462d
GitHub-Last-Rev: b84316c818
GitHub-Pull-Request: golang/go#49816
Reviewed-on: https://go-review.googlesource.com/c/go/+/367274
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-27 23:29:50 +00:00
tangxi666
9f2a075df9 cmd/go: fix a typo in mod_lazy_new_import.txt
x/y -> a/y

Change-Id: If24970623731098bb72345b8f4c8518b563bbec8
GitHub-Last-Rev: 8a35dddbc1
GitHub-Pull-Request: golang/go#49813
Reviewed-on: https://go-review.googlesource.com/c/go/+/367202
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-27 23:27:52 +00:00
sivchari
7e1260f62b testing: simplify fuzzResult.String to avoid unnecessarily using fmt.Sprintf
Change-Id: I16b6bfb6b0f02672c894b20845aa14d8dd1979b4
GitHub-Last-Rev: 75ab90123a
GitHub-Pull-Request: golang/go#49819
Reviewed-on: https://go-review.googlesource.com/c/go/+/367314
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-27 23:25:39 +00:00
Carlo Alberto Ferraris
a142d6587c doc: go1.18 release notes for CLs 323318/332771
Updates #47694

Change-Id: Ib76737996a701906117e096eb6d05b388576a874
GitHub-Last-Rev: 05b9649965
GitHub-Pull-Request: golang/go#49588
Reviewed-on: https://go-review.googlesource.com/c/go/+/363840
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
2021-11-27 19:49:32 +00:00
Tobias Klauser
fad67f8a53 cmd/go/internal: gofmt after CL 355010
Change-Id: I25902cc4e7a3d2a78b467825b723cd72b310e2a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/367094
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-27 01:14:21 +00:00
Keith Randall
1d47a1184a bufio: mention that panic at slicing means underlying reader is broken
Fixes #49795

Change-Id: I2b4fd14f0ed36b643522559bebf5ce52b1d7b304
Reviewed-on: https://go-review.googlesource.com/c/go/+/367214
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-26 22:36:21 +00:00
Roi Martin
bf88adadac cmd/doc: fix "builtin" package parsing
As stated in the code, "The builtin package needs special treatment: its
symbols are lower case but we want to see them, always". Thus, cmd/doc
forces the -u flag if the package being queried is called "builtin".
However, this happens after having already parsed the package. This
CL forces the -u flag just after parsing the command arguments and
before parsing any package.

Fixes #49796.

Change-Id: If690a900c7cfd1700feecb9529bd4344c3c249d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367134
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-26 20:49:40 +00:00
Jason A. Donenfeld
77038044ca doc/go1.18: document non-cooperative preemption on windows/arm{,64}
For #47694.
Updates #49759.

Change-Id: I7accd81b8ea6c31e4a2b5e155cf93fe9c447813b
Reviewed-on: https://go-review.googlesource.com/c/go/+/367095
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-26 13:18:11 +00:00
sivchari
a0506bdf7c test/fixedbugs: fix go directive of issue16008.go
This change modifies issue16008.go
I fixed // go:noinline to //go:noinline

Change-Id: Ic133eec51f0a7c4acf8cb22d25473ca08f1e916c
GitHub-Last-Rev: dd1868f2ca
GitHub-Pull-Request: golang/go#49801
Reviewed-on: https://go-review.googlesource.com/c/go/+/367174
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-26 13:06:40 +00:00
Chaoqun Han
45bae64015 A+C: add Chaoqun Han (individual CLA)
Change-Id: Id4aa067ef84510a31992d7d32cc697dd8b8342f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367035
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-25 04:02:39 +00:00
Jason A. Donenfeld
f7e34e705c runtime: support non-cooperative preemption on windows/arm64
This adds support for injecting asynchronous preemption calls on
windows/arm64. This code exactly follows sigctxt.pushCall for POSIX OSes
on arm64.

Fixes #49759.

Change-Id: Id35ff6bc105c1db9d7ed2918d3ecab0e4e9a9431
Reviewed-on: https://go-review.googlesource.com/c/go/+/366735
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
2021-11-25 00:07:28 +00:00
Jason A. Donenfeld
c58243aa8a runtime: support non-cooperative preemption on windows/arm
This adds support for injecting asynchronous preemption calls on
windows/arm. This code follows sigctxt.pushCall for POSIX OSes
on arm, except we subtract 1 from IP, just as in CL 273727.

Updates #10958.
Updates #24543.
Updates #49759.

Change-Id: Id0c2aed28662f50631b8c8cede3b4e6f088dafea
Reviewed-on: https://go-review.googlesource.com/c/go/+/366734
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-25 00:07:11 +00:00
Russ Cox
b2a5a3771f cmd/dist: add buildtag parsing test
Forgot to 'git add' this test written as part of CL 359314.

For #41184.

Change-Id: I2ebd48fd62a2053c8b16e5a8c48c1e11d1b86d5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/366894
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-25 00:02:52 +00:00
Robert Griesemer
b77f5f9667 cmd/compile/internal/types2: better error message for missing ~ in constraint
If a constraint could be satisfied if one of its type elements
had a ~, provide this information in the error message.

Fixes #49179.

Change-Id: I59f1a855a0646ad7254a978420b0334f1f52ec22
Reviewed-on: https://go-review.googlesource.com/c/go/+/366758
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-24 21:11:45 +00:00
Robert Griesemer
8cdfe408bb cmd/compile/internal/types2: better error position for instantiation failure
- Thread type argument expressions (rather than posLists) through various
type-checker functions so we can provide a better error position.

- Adjust signatures that expect a syntax.Pos to accept a poser instead
to avoid gratuituous conversions from expressions to positions.

- Rename targsx to xlist so we use xlist consistently for expression
lists.

First step in providing a better error message for the issue below.

For #49179.

Change-Id: I8fc685a2ee4f5640f4abd35568ba32bcb34e9e84
Reviewed-on: https://go-review.googlesource.com/c/go/+/366757
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-24 21:11:34 +00:00
Tobias Klauser
7e5331ac44 runtime: skip TestTimePprof on illumos
On illumos nanotime calls libc, like on the other systems for which
TestTimePprof is skipped.

For #43118

Change-Id: I370d3f098a261185920cb1e3e3402d16200e301a
Reviewed-on: https://go-review.googlesource.com/c/go/+/366737
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-24 21:09:36 +00:00
jiahua wang
5527d7ff79 doc/go1.18: add Clone doc
For #47694

Change-Id: I3b135f6ff199d7a9746726b131fbe7dd97a8e95e
Reviewed-on: https://go-review.googlesource.com/c/go/+/364254
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Heschi Kreinick <heschi@google.com>
2021-11-24 21:08:29 +00:00
Robert Griesemer
67dd9ee92c cmd/compile/internal/types2: produce empty type set for invalid ~T
If ~T is not permitted because the underlying type of T is not the
same as T, there is no type that satisfies ~T. Besides reporting an
error, also ensure that the corresponding type set is empty.

For #49739.

Change-Id: I127f75f170902e7989f7fe7b352dabda9f72e2a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/366278
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-24 20:59:14 +00:00
Robert Griesemer
c25bf0d959 cmd/compile/internal/types2: report types for mismatched call and return statements
Thanks to emmanuel@orijtech.com who wrote the initial version of
this change (CL 354490).

This change is following CL 354490 in idea but also contains various
simplifications, slightly improved printing of signature/type patterns,
adjustments for types2, and some fine-tuning of error positions.

Also adjusted several ERROR regexp patterns.

Fixes #48834.
Fixes #48835.

Change-Id: I31cf20c81753b1dc84836dbe83a39030ceb9db23
Reviewed-on: https://go-review.googlesource.com/c/go/+/364874
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-24 20:57:46 +00:00
Robert Griesemer
9e7600d3fc go/types: print "nil" rather than "untyped nil"
This is a port of CL 366276 from types2 to go/types
with minor adjustments due to the slightly different
handling of nil in go/types.

It uses some more detailed error strings in stmt0.src;
the same changes are made to the corresponding types2
file.

For #48852.

Change-Id: I2cdf258799bcbe2d12bbadaf67b8b4504b356bd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/366277
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-24 20:56:40 +00:00