diff options
| author | bors <bors@rust-lang.org> | 2013-09-27 19:16:05 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-27 19:16:05 -0700 |
| commit | 3ae895360c89b27bee7f076fded1c99691bd057e (patch) | |
| tree | 442c045cba4525660eb30caa27416bf8e8a6cbc2 /src/rustllvm/PassWrapper.cpp | |
| parent | 6828d2e01860593a687f36397eb38dc338f092a9 (diff) | |
| parent | c0e1c09783422870e4d6e5862459d45036bb24d7 (diff) | |
| download | rust-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
