Skip to content

Commit 5d6cd77

Browse files
committed
rollup merge of #18578 : japaric/clone
2 parents 11790a5 + 03b568a commit 5d6cd77

File tree

8 files changed

+29
-9
lines changed

8 files changed

+29
-9
lines changed

src/libcore/result.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,6 @@
276276
277277
#![stable]
278278

279-
use clone::Clone;
280279
use cmp::PartialEq;
281280
use std::fmt::Show;
282281
use slice;

src/libcore/str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use mem;
2020
use char;
2121
use char::Char;
22-
use clone::Clone;
2322
use cmp;
2423
use cmp::{PartialEq, Eq};
2524
use default::Default;

src/libstd/collections/hash/set.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
//
1111
// ignore-lexer-test FIXME #15883
1212

13-
use clone::Clone;
1413
use cmp::{Eq, Equiv, PartialEq};
1514
use core::kinds::Sized;
1615
use default::Default;

src/libstd/io/process.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use rt::rtio;
2626
use c_str::CString;
2727
use collections::HashMap;
2828
use hash::Hash;
29-
use clone::Clone;
3029
#[cfg(windows)]
3130
use std::hash::sip::SipState;
3231

src/libsyntax/ext/deriving/clone.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ fn cs_clone(
5252
name: &str,
5353
cx: &mut ExtCtxt, trait_span: Span,
5454
substr: &Substructure) -> P<Expr> {
55-
let clone_ident = substr.method_ident;
5655
let ctor_ident;
5756
let all_fields;
58-
let subcall = |field: &FieldInfo|
59-
cx.expr_method_call(field.span, field.self_.clone(), clone_ident, Vec::new());
57+
let fn_path = vec![
58+
cx.ident_of("std"),
59+
cx.ident_of("clone"),
60+
cx.ident_of("Clone"),
61+
cx.ident_of("clone"),
62+
];
63+
let subcall = |field: &FieldInfo| {
64+
let args = vec![cx.expr_addr_of(field.span, field.self_.clone())];
65+
66+
cx.expr_call_global(field.span, fn_path.clone(), args)
67+
};
6068

6169
match *substr.fields {
6270
Struct(ref af) => {

src/libunicode/u_str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* methods provided by the UnicodeChar trait.
1818
*/
1919

20-
use core::clone::Clone;
2120
use core::cmp;
2221
use core::slice::ImmutableSlice;
2322
use core::iter::{Filter, AdditiveIterator, Iterator, DoubleEndedIterator};

src/test/compile-fail/deriving-no-inner-impl-error-message.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ struct E {
1717
}
1818
#[deriving(Clone)]
1919
struct C {
20-
x: NoCloneOrEq //~ ERROR does not implement any method in scope named `clone`
20+
x: NoCloneOrEq
21+
//~^ ERROR the trait `core::clone::Clone` is not implemented for the type `NoCloneOrEq`
2122
}
2223

2324

src/test/run-pass/issue-15689-2.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
#[deriving(Clone)]
12+
enum Test<'a> {
13+
Slice(&'a int)
14+
}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)