about summary refs log tree commit diff
path: root/src/rustllvm/PassWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-27 19:16:05 -0700
committerbors <bors@rust-lang.org>2013-09-27 19:16:05 -0700
commit3ae895360c89b27bee7f076fded1c99691bd057e (patch)
tree442c045cba4525660eb30caa27416bf8e8a6cbc2 /src/rustllvm/PassWrapper.cpp
parent6828d2e01860593a687f36397eb38dc338f092a9 (diff)
parentc0e1c09783422870e4d6e5862459d45036bb24d7 (diff)
downloadrust-3ae895360c89b27bee7f076fded1c99691bd057e.tar.gz
rust-3ae895360c89b27bee7f076fded1c99691bd057e.zip
auto merge of #9557 : blake2-ppc/rust/vec-lifetime-token, r=thestinger
std::vec: Use a valid value as lifetime dummy in iterator

The current implementation uses `&v[0]` for the lifetime struct field,
but that is a dangling pointer for iterators derived from zero-length
slices.

Example:

    let v: [int, ..0] = [];  println!("{:?}", v.iter())

    std::vec::VecIterator<,int>{ptr: (0x7f3768626100 as *()), end: (0x7f3768626100 as *()), lifetime: &139875951207128}

To replace this parameter, use a field of type `Option<&'self ()>`
that is simply initialized with `None`, but still allows the iterator to
have a lifetime parameter.
Diffstat (limited to 'src/rustllvm/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions