Skip to content

Commit 06ded9c

Browse files
committed
explain phantom
1 parent 0a36ea7 commit 06ded9c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/doc/tarpl/vec-drain.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ untouched. For now we'll only implement the "basic" full-range version.
88
use std::marker::PhantomData;
99
1010
struct Drain<'a, T: 'a> {
11+
// Need to bound the lifetime here, so we do it with `&'a mut Vec<T>`
12+
// because that's semantically what we contain. We're "just" calling
13+
// `pop()` and `remove(0)`.
1114
vec: PhantomData<&'a mut Vec<T>>
1215
start: *const T,
1316
end: *const T,

0 commit comments

Comments
 (0)