Skip to content

Commit 9bb484e

Browse files
committed
---
yaml --- r: 205052 b: refs/heads/tmp c: e1e34e9 h: refs/heads/master v: v3
1 parent 4a685c3 commit 9bb484e

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: f0213d8ffb128a16f94af7ee985dc61484596163
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 52efe55d0425d963ee949be96e36d584a603a455
35+
refs/heads/tmp: e1e34e9275918679336210874f8dd770323daa81
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: f0ac7e04e647381e2bb87de1f3d0b108acb24d06
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/libcore/slice.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,14 @@ macro_rules! iterator {
665665
#[inline]
666666
fn next(&mut self) -> Option<$elem> {
667667
// could be implemented with slices, but this avoids bounds checks
668-
unsafe {
669-
if self.ptr == self.end {
670-
None
671-
} else {
668+
if self.ptr == self.end {
669+
None
670+
} else {
671+
unsafe {
672+
if mem::size_of::<T>() != 0 {
673+
::intrinsics::assume(!self.ptr.is_null());
674+
::intrinsics::assume(!self.end.is_null());
675+
}
672676
let old = self.ptr;
673677
self.ptr = slice_offset!(self.ptr, 1);
674678
Some(slice_ref!(old))
@@ -706,11 +710,15 @@ macro_rules! iterator {
706710
#[inline]
707711
fn next_back(&mut self) -> Option<$elem> {
708712
// could be implemented with slices, but this avoids bounds checks
709-
unsafe {
710-
if self.end == self.ptr {
711-
None
712-
} else {
713+
if self.end == self.ptr {
714+
None
715+
} else {
716+
unsafe {
713717
self.end = slice_offset!(self.end, -1);
718+
if mem::size_of::<T>() != 0 {
719+
::intrinsics::assume(!self.ptr.is_null());
720+
::intrinsics::assume(!self.end.is_null());
721+
}
714722
Some(slice_ref!(self.end))
715723
}
716724
}

0 commit comments

Comments
 (0)