about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-03 15:32:48 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-03 15:56:01 -0800
commit5d6cd7707036ef75a6fad90d4e5189e6916e1be8 (patch)
tree9d8612ee72484cd525323c27341bf32dc92c44e0
parent11790a545c77e0f35a00d2b27ff590393d705246 (diff)
parent03b568a846e71d2efac88325534c2142b6c25453 (diff)
downloadrust-5d6cd7707036ef75a6fad90d4e5189e6916e1be8.tar.gz
rust-5d6cd7707036ef75a6fad90d4e5189e6916e1be8.zip
rollup merge of #18578 : japaric/clone
-rw-r--r--src/libcore/result.rs1
-rw-r--r--src/libcore/str.rs1
-rw-r--r--src/libstd/collections/hash/set.rs1
-rw-r--r--src/libstd/io/process.rs1
-rw-r--r--src/libsyntax/ext/deriving/clone.rs14
-rw-r--r--src/libunicode/u_str.rs1
-rw-r--r--src/test/compile-fail/deriving-no-inner-impl-error-message.rs3
-rw-r--r--src/test/run-pass/issue-15689-2.rs16
8 files changed, 29 insertions, 9 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 82da972f68a..5b75e98baef 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -276,7 +276,6 @@
 
 #![stable]
 
-use clone::Clone;
 use cmp::PartialEq;
 use std::fmt::Show;
 use slice;
diff --git a/src/libcore/str.rs b/src/libcore/str.rs
index 3b29c257872..8937f2a946a 100644
--- a/src/libcore/str.rs
+++ b/src/libcore/str.rs
@@ -19,7 +19,6 @@
 use mem;
 use char;
 use char::Char;
-use clone::Clone;
 use cmp;
 use cmp::{PartialEq, Eq};
 use default::Default;
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index 823bd49d7a6..b9758e11bc7 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -10,7 +10,6 @@
 //
 // ignore-lexer-test FIXME #15883
 
-use clone::Clone;
 use cmp::{Eq, Equiv, PartialEq};
 use core::kinds::Sized;
 use default::Default;
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index 312a4c41ac9..493e1b559d7 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -26,7 +26,6 @@ use rt::rtio;
 use c_str::CString;
 use collections::HashMap;
 use hash::Hash;
-use clone::Clone;
 #[cfg(windows)]
 use std::hash::sip::SipState;
 
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 9748b531345..e653c8aebf4 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -52,11 +52,19 @@ fn cs_clone(
     name: &str,
     cx: &mut ExtCtxt, trait_span: Span,
     substr: &Substructure) -> P<Expr> {
-    let clone_ident = substr.method_ident;
     let ctor_ident;
     let all_fields;
-    let subcall = |field: &FieldInfo|
-        cx.expr_method_call(field.span, field.self_.clone(), clone_ident, Vec::new());
+    let fn_path = vec![
+        cx.ident_of("std"),
+        cx.ident_of("clone"),
+        cx.ident_of("Clone"),
+        cx.ident_of("clone"),
+    ];
+    let subcall = |field: &FieldInfo| {
+        let args = vec![cx.expr_addr_of(field.span, field.self_.clone())];
+
+        cx.expr_call_global(field.span, fn_path.clone(), args)
+    };
 
     match *substr.fields {
         Struct(ref af) => {
diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs
index 4bad631798f..9e3830c1f60 100644
--- a/src/libunicode/u_str.rs
+++ b/src/libunicode/u_str.rs
@@ -17,7 +17,6 @@
  * methods provided by the UnicodeChar trait.
  */
 
-use core::clone::Clone;
 use core::cmp;
 use core::slice::ImmutableSlice;
 use core::iter::{Filter, AdditiveIterator, Iterator, DoubleEndedIterator};
diff --git a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs
index 58593869d74..15a7bc01c3a 100644
--- a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs
+++ b/src/test/compile-fail/deriving-no-inner-impl-error-message.rs
@@ -17,7 +17,8 @@ struct E {
 }
 #[deriving(Clone)]
 struct C {
-    x: NoCloneOrEq //~ ERROR does not implement any method in scope named `clone`
+    x: NoCloneOrEq
+    //~^ ERROR the trait `core::clone::Clone` is not implemented for the type `NoCloneOrEq`
 }
 
 
diff --git a/src/test/run-pass/issue-15689-2.rs b/src/test/run-pass/issue-15689-2.rs
new file mode 100644
index 00000000000..026122d1259
--- /dev/null
+++ b/src/test/run-pass/issue-15689-2.rs
@@ -0,0 +1,16 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[deriving(Clone)]
+enum Test<'a> {
+    Slice(&'a int)
+}
+
+fn main() {}