From 06ded9c04e23ceaa41a4a5d01dd54432aaafd0db Mon Sep 17 00:00:00 2001 From: Alexis Beingessner Date: Mon, 20 Jul 2015 15:35:33 -0700 Subject: explain phantom --- src/doc/tarpl/vec-drain.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/doc/tarpl/vec-drain.md b/src/doc/tarpl/vec-drain.md index b6b28266600..23671978369 100644 --- a/src/doc/tarpl/vec-drain.md +++ b/src/doc/tarpl/vec-drain.md @@ -8,6 +8,9 @@ untouched. For now we'll only implement the "basic" full-range version. use std::marker::PhantomData; struct Drain<'a, T: 'a> { + // Need to bound the lifetime here, so we do it with `&'a mut Vec` + // because that's semantically what we contain. We're "just" calling + // `pop()` and `remove(0)`. vec: PhantomData<&'a mut Vec> start: *const T, end: *const T, -- cgit 1.4.1-3-g733a5