diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 82da972f68a35..5b75e98baefe2 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 3b29c25787292..8937f2a946a85 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 823bd49d7a663..b9758e11bc784 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 312a4c41ac9a6..493e1b559d7b7 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 9748b53134577..e653c8aebf447 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 { - 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 4bad631798fb2..9e3830c1f6090 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 58593869d747b..15a7bc01c3ae7 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 0000000000000..026122d1259f6 --- /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 or the MIT license +// , 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() {}