]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go1.20: document new semantics for comparable constraint
authorRobert Griesemer <gri@golang.org>
Thu, 1 Dec 2022 20:36:51 +0000 (12:36 -0800)
committerRobert Griesemer <gri@google.com>
Thu, 1 Dec 2022 20:58:25 +0000 (20:58 +0000)
For #54202.
For #56548.

Change-Id: If2b9e41813c3e1c8d373469a40e1bd0bd5ea2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/454595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
doc/go1.20.html

index 571c466134ef6f2b2d3b041905235a22bdeb67d2..ab09effaff34d4f5ec8e6c0373b02ede11351ce8 100644 (file)
@@ -26,7 +26,7 @@ Do not send CLs removing the interior tags from such phrases.
 <h2 id="language">Changes to the language</h2>
 
 <p>
-  Go 1.20 includes three changes to the language.
+  Go 1.20 includes four changes to the language.
 </p>
 
 <p><!-- https://go.dev/issue/46505 -->
@@ -56,6 +56,15 @@ Do not send CLs removing the interior tags from such phrases.
   what the implementations have always done.
 </p>
 
+<p><!-- https://go.dev/issue/56548 -->
+  <a href="/ref/spec#Comparison_operators">Comparable types</a> (such as ordinary interfaces)
+  may now satisfy <code>comparable</code> constraints, even if the type arguments
+  are not strictly comparable (comparison may panic at runtime).
+  This makes it possible to instantiate a type parameter constrained by <code>comparable</code>
+  (e.g., a type parameter for a user-defined generic map key) with a non-strictly comparable type argument
+  such as an interface type, or a composite type containing an interface type.
+</p>
+
 <h2 id="ports">Ports</h2>
 
 <h3 id="freebsd-riscv">FreeBSD/RISC-V</h3>