Skip to content

Commit 14bc454

Browse files
committed
remove redundant explanation
1 parent 06ded9c commit 14bc454

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

src/doc/tarpl/vec-into-iter.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,7 @@ struct IntoIter<T> {
5151
}
5252
```
5353

54-
One last subtle detail: if our Vec is empty, we want to produce an empty
55-
iterator. This will actually technically fall out doing the naive thing of:
56-
57-
```text
58-
start = ptr
59-
end = ptr.offset(len)
60-
```
61-
62-
However because `offset` is marked as a GEP inbounds instruction, this will tell
63-
LLVM that ptr is allocated and won't alias other allocated memory. This is fine
64-
for zero-sized types, as they can't alias anything. However if we're using
65-
`heap::EMPTY` as a sentinel for a non-allocation for a *non-zero-sized* type,
66-
this can cause Undefined Behaviour. Alas, we must therefore special case either
67-
cap or len being 0 to not do the offset.
68-
69-
So this is what we end up with for initialization:
54+
And this is what we end up with for initialization:
7055

7156
```rust,ignore
7257
impl<T> Vec<T> {

0 commit comments

Comments
 (0)