From ccd8498afbb371939b7decdbee712f726ccbded3 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Sat, 13 Sep 2014 19:06:01 +0300 Subject: syntax: fix fallout from using ptr::P. --- src/libsyntax/ext/deriving/cmp/eq.rs | 13 ++++++------- src/libsyntax/ext/deriving/cmp/ord.rs | 23 +++++++++++------------ src/libsyntax/ext/deriving/cmp/totaleq.rs | 12 +++++------- src/libsyntax/ext/deriving/cmp/totalord.rs | 13 ++++++------- 4 files changed, 28 insertions(+), 33 deletions(-) (limited to 'src/libsyntax/ext/deriving/cmp') diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs index 19a979a5655..a27016fde61 100644 --- a/src/libsyntax/ext/deriving/cmp/eq.rs +++ b/src/libsyntax/ext/deriving/cmp/eq.rs @@ -15,21 +15,20 @@ use ext::build::AstBuilder; use ext::deriving::generic::*; use ext::deriving::generic::ty::*; use parse::token::InternedString; - -use std::gc::Gc; +use ptr::P; pub fn expand_deriving_eq(cx: &mut ExtCtxt, span: Span, - mitem: Gc, - item: Gc, - push: |Gc|) { + mitem: &MetaItem, + item: &Item, + push: |P|) { // structures are equal if all fields are equal, and non equal, if // any fields are not equal or if the enum variants are different - fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> Gc { + fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } - fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> Gc { + fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P { cs_or(|cx, span, _, _| cx.expr_bool(span, true), cx, span, substr) } diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index dcf59ba820e..7cb61d295c0 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -16,14 +16,13 @@ use ext::build::AstBuilder; use ext::deriving::generic::*; use ext::deriving::generic::ty::*; use parse::token::InternedString; - -use std::gc::Gc; +use ptr::P; pub fn expand_deriving_ord(cx: &mut ExtCtxt, span: Span, - mitem: Gc, - item: Gc, - push: |Gc|) { + mitem: &MetaItem, + item: &Item, + push: |P|) { macro_rules! md ( ($name:expr, $op:expr, $equal:expr) => { { let inline = cx.meta_word(span, InternedString::new("inline")); @@ -87,7 +86,7 @@ pub enum OrderingOp { pub fn some_ordering_collapsed(cx: &mut ExtCtxt, span: Span, op: OrderingOp, - self_arg_tags: &[ast::Ident]) -> Gc { + self_arg_tags: &[ast::Ident]) -> P { let lft = cx.expr_ident(span, self_arg_tags[0]); let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1])); let op_str = match op { @@ -99,7 +98,7 @@ pub fn some_ordering_collapsed(cx: &mut ExtCtxt, } pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, - substr: &Substructure) -> Gc { + substr: &Substructure) -> P { let test_id = cx.ident_of("__test"); let ordering = cx.path_global(span, vec!(cx.ident_of("std"), @@ -159,8 +158,8 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, } /// Strict inequality. -fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, span: Span, - substr: &Substructure) -> Gc { +fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, + span: Span, substr: &Substructure) -> P { let op = if less {ast::BiLt} else {ast::BiGt}; cs_fold( false, // need foldr, @@ -183,14 +182,14 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, span: Span, layers of pointers, if the type includes pointers. */ let other_f = match other_fs { - [o_f] => o_f, + [ref o_f] => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`") }; - let cmp = cx.expr_binary(span, op, self_f, other_f); + let cmp = cx.expr_binary(span, op, self_f.clone(), other_f.clone()); let not_cmp = cx.expr_unary(span, ast::UnNot, - cx.expr_binary(span, op, other_f, self_f)); + cx.expr_binary(span, op, other_f.clone(), self_f)); let and = cx.expr_binary(span, ast::BiAnd, not_cmp, subexpr); cx.expr_binary(span, ast::BiOr, cmp, and) diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index 42365936c9d..98c8885f7fa 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -15,16 +15,14 @@ use ext::build::AstBuilder; use ext::deriving::generic::*; use ext::deriving::generic::ty::*; use parse::token::InternedString; - -use std::gc::Gc; +use ptr::P; pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, span: Span, - mitem: Gc, - item: Gc, - push: |Gc|) { - fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, - substr: &Substructure) -> Gc { + mitem: &MetaItem, + item: &Item, + push: |P|) { + fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P { cs_same_method(|cx, span, exprs| { // create `a.(); b.(); c.(); ...` // (where method is `assert_receiver_is_total_eq`) diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index e010b635fe4..9ef463f9c63 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -16,14 +16,13 @@ use ext::build::AstBuilder; use ext::deriving::generic::*; use ext::deriving::generic::ty::*; use parse::token::InternedString; - -use std::gc::Gc; +use ptr::P; pub fn expand_deriving_totalord(cx: &mut ExtCtxt, span: Span, - mitem: Gc, - item: Gc, - push: |Gc|) { + mitem: &MetaItem, + item: &Item, + push: |P|) { let inline = cx.meta_word(span, InternedString::new("inline")); let attrs = vec!(cx.attribute(span, inline)); let trait_def = TraitDef { @@ -53,14 +52,14 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt, pub fn ordering_collapsed(cx: &mut ExtCtxt, span: Span, - self_arg_tags: &[ast::Ident]) -> Gc { + self_arg_tags: &[ast::Ident]) -> P { let lft = 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, cx.ident_of("cmp"), vec![rgt]) } pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, - substr: &Substructure) -> Gc { + substr: &Substructure) -> P { let test_id = cx.ident_of("__test"); let equals_path = cx.path_global(span, vec!(cx.ident_of("std"), -- cgit 1.4.1-3-g733a5