about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros
diff options
context:
space:
mode:
authorSkgland <bb-github@t-online.de>2021-02-09 13:41:34 +0100
committerSkgland <bb-github@t-online.de>2021-02-09 13:42:35 +0100
commit2c33b070ad51c5a80e963beebc5c35ce976f05b5 (patch)
tree5be5a6bdb7c7a2d0d1bb100ade9d07a1ea960e71 /compiler/rustc_builtin_macros
parentc648bd55580a918d6f26f39bc167913a9da5ae3d (diff)
downloadrust-2c33b070ad51c5a80e963beebc5c35ce976f05b5.tar.gz
rust-2c33b070ad51c5a80e963beebc5c35ce976f05b5.zip
use ufcs in derive(Ord) and derive(PartialOrd)
Diffstat (limited to 'compiler/rustc_builtin_macros')
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs5
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs6
2 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
index c1473e24093..f84e6e07620 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
@@ -47,9 +47,10 @@ pub fn ordering_collapsed(
     span: Span,
     self_arg_tags: &[Ident],
 ) -> P<ast::Expr> {
-    let lft = cx.expr_ident(span, self_arg_tags[0]);
+    let lft = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[0]));
     let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1]));
-    cx.expr_method_call(span, lft, Ident::new(sym::cmp, span), vec![rgt])
+    let fn_cmp_path = cx.std_path(&[sym::cmp, sym::Ord, sym::cmp]);
+    cx.expr_call_global(span, fn_cmp_path, vec![lft, rgt])
 }
 
 pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> {
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
index db808bf2ff5..151a919e029 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
@@ -107,9 +107,11 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_
             if self_args.len() != 2 {
                 cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`")
             } else {
-                let lft = cx.expr_ident(span, tag_tuple[0]);
+                let lft = cx.expr_addr_of(span, cx.expr_ident(span, tag_tuple[0]));
                 let rgt = cx.expr_addr_of(span, cx.expr_ident(span, tag_tuple[1]));
-                cx.expr_method_call(span, lft, Ident::new(sym::partial_cmp, span), vec![rgt])
+                let fn_partial_cmp_path =
+                    cx.std_path(&[sym::cmp, sym::PartialOrd, sym::partial_cmp]);
+                cx.expr_call_global(span, fn_partial_cmp_path, vec![lft, rgt])
             }
         }),
         cx,