rollup merge of #18578 : japaric/clone

This commit is contained in:
Alex Crichton 2014-11-03 15:32:48 -08:00
commit 5d6cd77070
8 changed files with 29 additions and 9 deletions

View File

@ -276,7 +276,6 @@
#![stable]
use clone::Clone;
use cmp::PartialEq;
use std::fmt::Show;
use slice;

View File

@ -19,7 +19,6 @@
use mem;
use char;
use char::Char;
use clone::Clone;
use cmp;
use cmp::{PartialEq, Eq};
use default::Default;

View File

@ -10,7 +10,6 @@
//
// ignore-lexer-test FIXME #15883
use clone::Clone;
use cmp::{Eq, Equiv, PartialEq};
use core::kinds::Sized;
use default::Default;

View File

@ -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;

View File

@ -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) => {

View File

@ -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};

View File

@ -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`
}

View File

@ -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() {}