Skip to content

Commit bb1b837

Browse files
committed
---
yaml --- r: 64659 b: refs/heads/snap-stage3 c: cced3c9 h: refs/heads/master i: 64657: 4801a0d 64655: 7a103c6 v: v3
1 parent 693d655 commit bb1b837

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
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: 037a5b1af4b66e44d6d2130cedb576c5659bac8c
4+
refs/heads/snap-stage3: cced3c9013e4f8e1202b6088f9d3b564e40cac40
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,11 +1957,8 @@ impl<'self> StrSlice<'self> for &'self str {
19571957
*/
19581958
#[inline]
19591959
fn as_imm_buf<T>(&self, f: &fn(*u8, uint) -> T) -> T {
1960-
unsafe {
1961-
let v: *(*u8, uint) = cast::transmute(self);
1962-
let (buf, len) = *v;
1963-
f(buf, len)
1964-
}
1960+
let v: &[u8] = unsafe { cast::transmute(*self) };
1961+
v.as_imm_buf(f)
19651962
}
19661963
19671964
/**

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,7 @@ pub trait MutableVector<'self, T> {
16911691
unsafe fn unsafe_mut_ref(&self, index: uint) -> *mut T;
16921692
unsafe fn unsafe_set(&self, index: uint, val: T);
16931693

1694-
fn as_mut_buf<U>(&self, f: &fn(*mut T, uint) -> U) -> U;
1694+
fn as_mut_buf<U>(self, f: &fn(*mut T, uint) -> U) -> U;
16951695
}
16961696

16971697
impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
@@ -1783,12 +1783,9 @@ impl<'self,T> MutableVector<'self, T> for &'self mut [T] {
17831783

17841784
/// Similar to `as_imm_buf` but passing a `*mut T`
17851785
#[inline]
1786-
fn as_mut_buf<U>(&self, f: &fn(*mut T, uint) -> U) -> U {
1787-
unsafe {
1788-
let v : *(*mut T,uint) = transmute(self);
1789-
let (buf,len) = *v;
1790-
f(buf, len / sys::nonzero_size_of::<T>())
1791-
}
1786+
fn as_mut_buf<U>(self, f: &fn(*mut T, uint) -> U) -> U {
1787+
let (buf, len): (*mut T, uint) = unsafe { transmute(self) };
1788+
f(buf, len / sys::nonzero_size_of::<T>())
17921789
}
17931790

17941791
}

0 commit comments

Comments
 (0)