diff --git a/doc/go1.20.html b/doc/go1.20.html index 5fadb3e3aa3..fa712696ffb 100644 --- a/doc/go1.20.html +++ b/doc/go1.20.html @@ -26,15 +26,34 @@ Do not send CLs removing the interior tags from such phrases.
- TODO: complete this section -
- -- TODO: https://go.dev/issue/8606: define that structs are compared field-by-field as listed in source code + Go 1.20 includes three changes to the language.
- TODO: https://go.dev/issue/46505: allow conversion from slice to array
+ Go 1.17 added conversions from slice to an array pointer.
+ Go 1.20 extends this to allow conversions from a slice to an array:
+ given a slice x
, [4]byte(x)
can now be written
+ instead of *(*[4]byte)(x)
.
+
+ The unsafe
package defines
+ three new functions SliceData
, String
, and StringData
.
+ Along with Go 1.17's Slice
, these functions now provide the complete ability to
+ construct and deconstruct slice and string values, without depending on their exact representation.
+
+ The specification now defines that struct values are compared one field at a time, + considering fields in the order they appear in the struct type definition, + and stopping at the first mismatch. + The specification could previously have been read as if + all fields needed to be compared beyond the first mismatch. + Similarly, the specification now defines that array values are compared + one element at a time, in increasing index order. + In both cases, the difference affects whether certain comparisons must panic. + Existing programs are unchanged: the new spec wording describes + what the implementations have always done.