File tree 2 files changed +29
-13
lines changed
2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ the `clone` method.
23
23
24
24
#![ unstable]
25
25
26
+ use kinds:: Sized ;
27
+
26
28
/// A common trait for cloning an object.
27
29
pub trait Clone {
28
30
/// Returns a copy of the value.
@@ -40,24 +42,12 @@ pub trait Clone {
40
42
}
41
43
}
42
44
43
- impl < ' a , T > Clone for & ' a T {
45
+ impl < ' a , Sized ? T > Clone for & ' a T {
44
46
/// Return a shallow copy of the reference.
45
47
#[ inline]
46
48
fn clone ( & self ) -> & ' a T { * self }
47
49
}
48
50
49
- impl < ' a , T > Clone for & ' a [ T ] {
50
- /// Return a shallow copy of the slice.
51
- #[ inline]
52
- fn clone ( & self ) -> & ' a [ T ] { * self }
53
- }
54
-
55
- impl < ' a > Clone for & ' a str {
56
- /// Return a shallow copy of the slice.
57
- #[ inline]
58
- fn clone ( & self ) -> & ' a str { * self }
59
- }
60
-
61
51
macro_rules! clone_impl(
62
52
( $t: ty) => {
63
53
impl Clone for $t {
Original file line number Diff line number Diff line change
1
+ // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ struct Str ( [ u8 ] ) ;
12
+
13
+ #[ deriving( Clone ) ]
14
+ struct CharSplits < ' a , Sep > {
15
+ string : & ' a Str ,
16
+ sep : Sep ,
17
+ allow_trailing_empty : bool ,
18
+ only_ascii : bool ,
19
+ finished : bool ,
20
+ }
21
+
22
+ fn clone ( s : & Str ) -> & Str {
23
+ Clone :: clone ( & s)
24
+ }
25
+
26
+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments