File tree 2 files changed +6
-9
lines changed 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: 1b7733109d7b692c2ddd404f1bb6c751c3194750
8
+ refs/heads/try2: 07c5e5d81363b6cdbca64637832620ab4870d258
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -26,19 +26,16 @@ pub fn id<T>(x: T) -> T { x }
26
26
pub fn swap < T > ( x : & mut T , y : & mut T ) {
27
27
unsafe {
28
28
// 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 ( ) ;
31
30
32
31
// 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 ) ;
38
35
39
36
// y and t now point to the same thing, but we need to completely forget `tmp`
40
37
// because it's no longer relevant.
41
- cast:: forget ( tmp ) ;
38
+ cast:: forget ( t ) ;
42
39
}
43
40
}
44
41
You can’t perform that action at this time.
0 commit comments