diff options
| author | blake2-ppc <blake2-ppc> | 2013-09-27 05:50:33 +0200 |
|---|---|---|
| committer | blake2-ppc <blake2-ppc> | 2013-09-27 06:06:13 +0200 |
| commit | c0e1c09783422870e4d6e5862459d45036bb24d7 (patch) | |
| tree | eb2dcc83402cf43699fe40dec080b348a39248db /src/rustllvm/PassWrapper.cpp | |
| parent | 48499c7494d47f505a640157816cea2690b8d407 (diff) | |
| download | rust-c0e1c09783422870e4d6e5862459d45036bb24d7.tar.gz rust-c0e1c09783422870e4d6e5862459d45036bb24d7.zip | |
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
