diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-15 14:11:58 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-15 14:11:58 -0800 |
| commit | c3c47f5f55ca800b229fb5821825036fcc9ae0fc (patch) | |
| tree | 993a4ddd6b74809230df4caeac0d382374247e68 /src/libsyntax/ext | |
| parent | 9d4d5ca6e7d19fd9be6775289e465fefddab69f5 (diff) | |
| parent | 28b0d4029e3ae65505b19bf74379a8516b0e1fc9 (diff) | |
| download | rust-c3c47f5f55ca800b229fb5821825036fcc9ae0fc.tar.gz rust-c3c47f5f55ca800b229fb5821825036fcc9ae0fc.zip | |
rollup merge of #21161: japaric/ufcs-hash
expansion now uses `::std::hash::Hash::hash(&*__self_0_0, __arg_0)` instead of `(*__self_0_0).hash(__arg_0)` closes #21160 r? @alexcrichton
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/deriving/hash.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libsyntax/ext/deriving/hash.rs b/src/libsyntax/ext/deriving/hash.rs index db99c142443..889a212a287 100644 --- a/src/libsyntax/ext/deriving/hash.rs +++ b/src/libsyntax/ext/deriving/hash.rs @@ -65,9 +65,19 @@ fn hash_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) [ref state_expr] => state_expr, _ => cx.span_bug(trait_span, "incorrect number of arguments in `deriving(Hash)`") }; - let hash_ident = substr.method_ident; let call_hash = |&: span, thing_expr| { - let expr = cx.expr_method_call(span, thing_expr, hash_ident, vec!(state_expr.clone())); + let hash_path = { + let strs = vec![ + cx.ident_of("std"), + cx.ident_of("hash"), + cx.ident_of("Hash"), + cx.ident_of("hash"), + ]; + + cx.expr_path(cx.path_global(span, strs)) + }; + let ref_thing = cx.expr_addr_of(span, thing_expr); + let expr = cx.expr_call(span, hash_path, vec!(ref_thing, state_expr.clone())); cx.stmt_expr(expr) }; let mut stmts = Vec::new(); |
