Skip to content

Commit b8e520b

Browse files
committed
---
yaml --- r: 149054 b: refs/heads/try2 c: 07c5e5d h: refs/heads/master v: v3
1 parent 84d5d38 commit b8e520b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
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: 1b7733109d7b692c2ddd404f1bb6c751c3194750
8+
refs/heads/try2: 07c5e5d81363b6cdbca64637832620ab4870d258
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/util.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,16 @@ pub fn id<T>(x: T) -> T { x }
2626
pub fn swap<T>(x: &mut T, y: &mut T) {
2727
unsafe {
2828
// Give ourselves some scratch space to work with
29-
let mut tmp: T = mem::uninit();
30-
let t: *mut T = &mut tmp;
29+
let mut t: T = mem::uninit();
3130

3231
// Perform the swap, `&mut` pointers never alias
33-
let x_raw: *mut T = x;
34-
let y_raw: *mut T = y;
35-
ptr::copy_nonoverlapping_memory(t, &*x_raw, 1);
36-
ptr::copy_nonoverlapping_memory(x, &*y_raw, 1);
37-
ptr::copy_nonoverlapping_memory(y, &*t, 1);
32+
ptr::copy_nonoverlapping_memory(&mut t, &*x, 1);
33+
ptr::copy_nonoverlapping_memory(x, &*y, 1);
34+
ptr::copy_nonoverlapping_memory(y, &t, 1);
3835

3936
// y and t now point to the same thing, but we need to completely forget `tmp`
4037
// because it's no longer relevant.
41-
cast::forget(tmp);
38+
cast::forget(t);
4239
}
4340
}
4441

0 commit comments

Comments
 (0)