diff --git a/src/vec/vec-raw.md b/src/vec/vec-raw.md index f4421db..a7d8dbe 100644 --- a/src/vec/vec-raw.md +++ b/src/vec/vec-raw.md @@ -145,7 +145,12 @@ impl Vec { IntoIter { start: buf.ptr.as_ptr(), - end: buf.ptr.as_ptr().add(len), + end: if buf.cap == 0 { + // can't offset off of a pointer unless it's part of an allocation + buf.ptr.as_ptr() + } else { + buf.ptr.as_ptr().add(len) + }, _buf: buf, } }