File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: 2d28d645422c1617be58c8ca7ad9a457264ca850
5
- refs/heads/try: 7bef1ff4b19805f6b452697ad5febd4965cfaea3
5
+ refs/heads/try: 92a1f6de97c8360c77763d4e6ef9fc6b6775cfc0
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ impl<T> Clone for @mut T {
48
48
fn clone ( & self ) -> @mut T { * self }
49
49
}
50
50
51
+ impl < ' self , T > Clone for & ' self T {
52
+ /// Return a shallow copy of the borrowed pointer.
53
+ #[ inline( always) ]
54
+ fn clone ( & self ) -> & ' self T { * self }
55
+ }
56
+
51
57
macro_rules! clone_impl(
52
58
( $t: ty) => {
53
59
impl Clone for $t {
@@ -166,3 +172,11 @@ fn test_managed_mut_clone() {
166
172
* b = 10 ;
167
173
assert ! ( a == b) ;
168
174
}
175
+
176
+ #[ test]
177
+ fn test_borrowed_clone ( ) {
178
+ let x = 5 i;
179
+ let y: & int = & x;
180
+ let z: & int = ( & y) . clone ( ) ;
181
+ assert_eq ! ( * z, 5 ) ;
182
+ }
You can’t perform that action at this time.
0 commit comments