Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information