]> Cypherpunks repositories - gostls13.git/commitdiff
spec: clarify behavior of map size hint for make built-in
authorRobert Griesemer <gri@golang.org>
Mon, 13 Jun 2022 18:06:55 +0000 (11:06 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 13 Jun 2022 19:06:53 +0000 (19:06 +0000)
The spec already states that the precise behavior of the map size
hint provided to the make built-in is implementation-dependent.

Exclude requiring specific run-time behavior for maps.
(The current Go compiler does not panic if the size hint is negative
at run-time.)

Fixes #53219.

Change-Id: I2f3618bf9ba4ed921e18dc4f2273eaa770805bd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/411919
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
doc/go_spec.html

index 170c359c87bce621b62e539778e27347c27e3641..b5f6c5fd6571c40a6f5586008c7a2b296ea6408e 100644 (file)
@@ -7141,7 +7141,7 @@ A constant size argument must be non-negative and <a href="#Representability">re
 by a value of type <code>int</code>; if it is an untyped constant it is given type <code>int</code>.
 If both <code>n</code> and <code>m</code> are provided and are constant, then
 <code>n</code> must be no larger than <code>m</code>.
-If <code>n</code> is negative or larger than <code>m</code> at run time,
+For slices and channels, if <code>n</code> is negative or larger than <code>m</code> at run time,
 a <a href="#Run_time_panics">run-time panic</a> occurs.
 </p>