diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-11-03 15:32:48 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-03 15:56:01 -0800 |
| commit | 5d6cd7707036ef75a6fad90d4e5189e6916e1be8 (patch) | |
| tree | 9d8612ee72484cd525323c27341bf32dc92c44e0 /src/libsyntax | |
| parent | 11790a545c77e0f35a00d2b27ff590393d705246 (diff) | |
| parent | 03b568a846e71d2efac88325534c2142b6c25453 (diff) | |
| download | rust-5d6cd7707036ef75a6fad90d4e5189e6916e1be8.tar.gz rust-5d6cd7707036ef75a6fad90d4e5189e6916e1be8.zip | |
rollup merge of #18578 : japaric/clone
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/deriving/clone.rs | 14 |
1 files changed, 11 insertions, 3 deletions
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) => { |
