Skip to content

Commit ae3d470

Browse files
committed
---
yaml --- r: 128799 b: refs/heads/try c: 033f28d h: refs/heads/master i: 128797: fc824bd 128795: dcfc2ed 128791: bc9a23a 128783: 22fcd75 128767: 46a1fc7 v: v3
1 parent d8e3a7b commit ae3d470

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 07d86b46a949a94223da714e35b343243e4ecce4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a86d9ad15e339ab343a12513f9c90556f677b9ca
5-
refs/heads/try: fbc93082ec92c3534c4b27fef35d78d97bd77fd2
5+
refs/heads/try: 033f28d4364e0bd0ff7031b67e6bd0356fe00bfd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcollections/string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl String {
141141
let mut i = 0;
142142
let total = v.len();
143143
fn unsafe_get(xs: &[u8], i: uint) -> u8 {
144-
unsafe { *xs.unsafe_ref(i) }
144+
unsafe { *xs.unsafe_get(i) }
145145
}
146146
fn safe_get(xs: &[u8], i: uint, total: uint) -> u8 {
147147
if i >= total {

branches/try/src/libcollections/trie.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ macro_rules! iterator_impl {
926926
// such thing as invalid pointers and memory unsafety. The
927927
// reason is performance, without doing this we can get the
928928
// bench_iter_large microbenchmark down to about 30000 ns/iter
929-
// (using .unsafe_ref to index self.stack directly, 38000
929+
// (using .unsafe_get to index self.stack directly, 38000
930930
// ns/iter with [] checked indexing), but this smashes that down
931931
// to 13500 ns/iter.
932932
//

branches/try/src/libcollections/vec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl<T: Clone> Vec<T> {
348348
unsafe {
349349
ptr::write(
350350
self.as_mut_slice().unsafe_mut_ref(len),
351-
other.unsafe_ref(i).clone());
351+
other.unsafe_get(i).clone());
352352
self.set_len(len + 1);
353353
}
354354
}
@@ -703,7 +703,7 @@ impl<T> Vec<T> {
703703
// decrement len before the read(), so a failure on Drop doesn't
704704
// re-drop the just-failed value.
705705
self.len -= 1;
706-
ptr::read(self.as_slice().unsafe_ref(self.len));
706+
ptr::read(self.as_slice().unsafe_get(self.len));
707707
}
708708
}
709709
}
@@ -1605,7 +1605,7 @@ impl<T> MutableSeq<T> for Vec<T> {
16051605
} else {
16061606
unsafe {
16071607
self.len -= 1;
1608-
Some(ptr::read(self.as_slice().unsafe_ref(self.len())))
1608+
Some(ptr::read(self.as_slice().unsafe_get(self.len())))
16091609
}
16101610
}
16111611
}

branches/try/src/libcore/slice.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,14 @@ pub trait ImmutableSlice<'a, T> {
173173

174174
/// Returns a pointer to the element at the given index, without doing
175175
/// bounds checking.
176+
#[deprecated = "renamed to `unsafe_get`"]
176177
unsafe fn unsafe_ref(self, index: uint) -> &'a T;
177178

179+
/// Returns a pointer to the element at the given index, without doing
180+
/// bounds checking.
181+
#[unstable]
182+
unsafe fn unsafe_get(self, index: uint) -> &'a T;
183+
178184
/**
179185
* Returns an unsafe pointer to the vector's buffer
180186
*
@@ -351,10 +357,16 @@ impl<'a,T> ImmutableSlice<'a, T> for &'a [T] {
351357
}
352358

353359
#[inline]
360+
#[deprecated = "renamed to `unsafe_get`"]
354361
unsafe fn unsafe_ref(self, index: uint) -> &'a T {
355362
transmute(self.repr().data.offset(index as int))
356363
}
357364

365+
#[inline]
366+
unsafe fn unsafe_get(self, index: uint) -> &'a T {
367+
transmute(self.repr().data.offset(index as int))
368+
}
369+
358370
#[inline]
359371
fn as_ptr(&self) -> *const T {
360372
self.repr().data

branches/try/src/librand/isaac.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl Isaac64Rng {
348348
static MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
349349
macro_rules! ind (
350350
($x:expr) => {
351-
*self.mem.unsafe_ref(($x as uint >> 3) & (RAND_SIZE_64 - 1))
351+
*self.mem.unsafe_get(($x as uint >> 3) & (RAND_SIZE_64 - 1))
352352
}
353353
);
354354

@@ -362,8 +362,8 @@ impl Isaac64Rng {
362362
let mix = if $j == 0 {!mix} else {mix};
363363

364364
unsafe {
365-
let x = *self.mem.unsafe_ref(base + mr_offset);
366-
a = mix + *self.mem.unsafe_ref(base + m2_offset);
365+
let x = *self.mem.unsafe_get(base + mr_offset);
366+
a = mix + *self.mem.unsafe_get(base + m2_offset);
367367
let y = ind!(x) + a + b;
368368
self.mem.unsafe_set(base + mr_offset, y);
369369

@@ -379,8 +379,8 @@ impl Isaac64Rng {
379379
let mix = if $j == 0 {!mix} else {mix};
380380

381381
unsafe {
382-
let x = *self.mem.unsafe_ref(base + mr_offset);
383-
a = mix + *self.mem.unsafe_ref(base + m2_offset);
382+
let x = *self.mem.unsafe_get(base + mr_offset);
383+
a = mix + *self.mem.unsafe_get(base + m2_offset);
384384
let y = ind!(x) + a + b;
385385
self.mem.unsafe_set(base + mr_offset, y);
386386

@@ -416,7 +416,7 @@ impl Rng for Isaac64Rng {
416416
self.isaac64();
417417
}
418418
self.cnt -= 1;
419-
unsafe { *self.rsl.unsafe_ref(self.cnt) }
419+
unsafe { *self.rsl.unsafe_get(self.cnt) }
420420
}
421421
}
422422

0 commit comments

Comments
 (0)