Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
c0e1c09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from thestinger
at https://github.com/blake2-ppc/rust/commit/c0e1c09783422870e4d6e5862459d45036bb24d7
c0e1c09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging blake2-ppc/rust/vec-lifetime-token = c0e1c09 into auto
c0e1c09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blake2-ppc/rust/vec-lifetime-token = c0e1c09 merged ok, testing candidate = 3ae8953
c0e1c09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1736
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1739
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/845
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/845
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1754
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/845
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/845
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1754
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/845
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/846
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/926
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1738
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/845
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/846
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/1523
c0e1c09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 3ae8953