]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #25300 - kballard:core-slice-overflow, r=Gankro
authorbors <bors@rust-lang.org>
Tue, 12 May 2015 14:39:31 +0000 (14:39 +0000)
committerbors <bors@rust-lang.org>
Tue, 12 May 2015 14:39:31 +0000 (14:39 +0000)
core::slice was originally written to tolerate overflow (notably, with
slices of zero-sized elements), but it was never updated to use wrapping
arithmetic when overflow traps were added.

Also correctly handle the case of calling .nth() on an Iter with a
zero-sized element type. The iterator was assuming that the pointer
value of the returned reference was meaningful, but that's not true for
zero-sized elements.

Fixes #25016.


Trivial merge