Skip to content

Commit ed75a23

Browse files
author
blake2-ppc
committed
---
yaml --- r: 64842 b: refs/heads/snap-stage3 c: 2ff8412 h: refs/heads/master v: v3
1 parent 264e11f commit ed75a23

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 66fccdb2958fef88e00236497aec5e0f99fe7d02
4+
refs/heads/snap-stage3: 2ff84124f0d39b20f49ce04f71d31322cdf1a327
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,8 @@ macro_rules! iterator {
21062106

21072107
#[inline]
21082108
fn size_hint(&self) -> (uint, Option<uint>) {
2109-
let exact = self.indexable();
2109+
let diff = (self.end as uint) - (self.ptr as uint);
2110+
let exact = diff / sys::nonzero_size_of::<T>();
21102111
(exact, Some(exact))
21112112
}
21122113
}
@@ -2139,8 +2140,8 @@ macro_rules! random_access_iterator {
21392140
impl<'self, T> RandomAccessIterator<$elem> for $name<'self, T> {
21402141
#[inline]
21412142
fn indexable(&self) -> uint {
2142-
let diff = (self.end as uint) - (self.ptr as uint);
2143-
diff / sys::nonzero_size_of::<T>()
2143+
let (exact, _) = self.size_hint();
2144+
exact
21442145
}
21452146

21462147
fn idx(&self, index: uint) -> Option<$elem> {
@@ -2181,7 +2182,6 @@ pub struct VecMutIterator<'self, T> {
21812182
}
21822183
iterator!{impl VecMutIterator -> &'self mut T}
21832184
double_ended_iterator!{impl VecMutIterator -> &'self mut T}
2184-
random_access_iterator!{impl VecMutIterator -> &'self mut T}
21852185
pub type MutRevIterator<'self, T> = Invert<VecMutIterator<'self, T>>;
21862186

21872187
/// An iterator that moves out of a vector.

0 commit comments

Comments
 (0)