Skip to content

Commit

Permalink
spec: document conversion from slice to array
Browse files Browse the repository at this point in the history
Document that a slice can be converted to either an array or a pointer
to an array of a matching underlying array type. This was documented in
the "Conversions from slice to array or array pointer" subsection, but
not in the list of conversion rules.

Updates #46505.

Change-Id: I16a89a63ef23c33580129952415e977a8f334009
Reviewed-on: https://go-review.googlesource.com/c/go/+/452936
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Robert Griesemer <[email protected]>
Run-TryBot: Tim King <[email protected]>
  • Loading branch information
timothy-king committed Nov 30, 2022
1 parent 7847260 commit 60525dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/go_spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -5348,7 +5348,7 @@ <h3 id="Conversions">Conversions</h3>
<code>x</code> is a string and <code>T</code> is a slice of bytes or runes.
</li>
<li>
<code>x</code> is a slice, <code>T</code> is a pointer to an array,
<code>x</code> is a slice, <code>T</code> is an array or a pointer to an array,
and the slice and array types have <a href="#Type_identity">identical</a> element types.
</li>
</ul>
Expand Down

0 comments on commit 60525dc

Please sign in to comment.