blob: d70cc28d2e4690b7c4be5f0853cbdcc449818f18 [file] [log] [blame] [view]
---
title: InvalidUnsafeSlice
layout: article
---
<!-- Copyright 2023 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file. -->
<!-- Code generated by generrordocs.go; DO NOT EDIT. -->
```
InvalidUnsafeSlice occurs when unsafe.Slice is called with a
pointer argument that is not of pointer type or a length argument
that is not of integer type, negative, or out of bounds.
It also occurs if it is used in a package compiled for a language
version before go1.17.
Example:
import "unsafe"
var x int
var _ = unsafe.Slice(x, 1)
Example:
import "unsafe"
var x int
var _ = unsafe.Slice(&x, float64(1))
Example:
import "unsafe"
var x int
var _ = unsafe.Slice(&x, -1)
Example:
import "unsafe"
var x int
var _ = unsafe.Slice(&x, uint64(1) {{raw "<"}}{{raw "<"}} 63)
```