File tree Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,8 @@ the `clone` method.
2323
2424#![ unstable]
2525
26+ use kinds:: Sized ;
27+
2628/// A common trait for cloning an object.
2729pub trait Clone {
2830 /// Returns a copy of the value.
@@ -40,24 +42,12 @@ pub trait Clone {
4042 }
4143}
4244
43- impl < ' a , T > Clone for & ' a T {
45+ impl < ' a , Sized ? T > Clone for & ' a T {
4446 /// Return a shallow copy of the reference.
4547 #[ inline]
4648 fn clone ( & self ) -> & ' a T { * self }
4749}
4850
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-
6151macro_rules! clone_impl(
6252 ( $t: ty) => {
6353 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