Skip to content

Commit 3f02e00

Browse files
committed
---
yaml --- r: 143213 b: refs/heads/try2 c: cced3c9 h: refs/heads/master i: 143211: f71af6c v: v3
1 parent ce9f2d5 commit 3f02e00

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 037a5b1af4b66e44d6d2130cedb576c5659bac8c
8+
refs/heads/try2: cced3c9013e4f8e1202b6088f9d3b564e40cac40
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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/try2/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)