File tree Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Original file line number Diff line number Diff line change @@ -51,22 +51,7 @@ struct IntoIter<T> {
51
51
}
52
52
```
53
53
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:
70
55
71
56
``` rust,ignore
72
57
impl<T> Vec<T> {
You can’t perform that action at this time.
0 commit comments