diff --git a/doc/go1.17.html b/doc/go1.17.html index 7438d894fe..c1978ff1c1 100644 --- a/doc/go1.17.html +++ b/doc/go1.17.html @@ -25,12 +25,46 @@ Do not send CLs removing the interior tags from such phrases.
- TODO: https://golang.org/cl/216424: allow conversion from slice to array ptr +
+ Go 1.17 includes three small enhancements to the language.
-- TODO: https://golang.org/cl/312212: add unsafe.Add and unsafe.Slice +
s of
+ type []T may now be converted to array pointer type
+ *[N]T. If a is the result of such a
+ conversion, then corresponding indices that are in range refer to
+ the same underlying elements: &a[i] == &s[i]
+ for 0 <= i < N. The conversion panics if
+ len(s) is less than N.
+ unsafe.Add:
+ unsafe.Add(ptr, len) adds len
+ to ptr and returns the updated pointer
+ unsafe.Pointer(uintptr(ptr) + uintptr(len)).
+ unsafe.Slice:
+ For expression ptr of type *T,
+ unsafe.Slice(ptr, len) returns a slice of
+ type []T whose underlying array starts
+ at ptr and whose length and capacity
+ are len.
+
+ These enhancements were added to simplify writing code that conforms
+ to unsafe.Pointer's safety
+ rules, but the rules remain unchanged. In particular, existing
+ programs that correctly use unsafe.Pointer remain
+ valid, and new programs must still follow the rules when
+ using unsafe.Add or unsafe.Slice.