diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-09-13 19:06:01 +0300 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-09-14 03:39:36 +0300 |
| commit | ccd8498afbb371939b7decdbee712f726ccbded3 (patch) | |
| tree | 8939c9dba98ee7a2f624e82c3c72dcf33576d350 /src/libsyntax/ext/deriving/cmp | |
| parent | d6fb338d01864e3801cab9f76d608f204d11fc27 (diff) | |
| download | rust-ccd8498afbb371939b7decdbee712f726ccbded3.tar.gz rust-ccd8498afbb371939b7decdbee712f726ccbded3.zip | |
syntax: fix fallout from using ptr::P.
Diffstat (limited to 'src/libsyntax/ext/deriving/cmp')
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/eq.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/ord.rs | 23 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totaleq.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totalord.rs | 13 |
4 files changed, 28 insertions, 33 deletions
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<MetaItem>, - item: Gc<Item>, - push: |Gc<Item>|) { + mitem: &MetaItem, + item: &Item, + push: |P<Item>|) { // 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<Expr> { + fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { cs_and(|cx, span, _, _| cx.expr_bool(span, false), cx, span, substr) } - fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> Gc<Expr> { + fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { 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<MetaItem>, - item: Gc<Item>, - push: |Gc<Item>|) { + mitem: &MetaItem, + item: &Item, + push: |P<Item>|) { 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<ast::Expr> { + self_arg_tags: &[ast::Ident]) -> P<ast::Expr> { 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<Expr> { + substr: &Substructure) -> P<Expr> { 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<Expr> { +fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, + span: Span, substr: &Substructure) -> P<Expr> { 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<MetaItem>, - item: Gc<Item>, - push: |Gc<Item>|) { - fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, - substr: &Substructure) -> Gc<Expr> { + mitem: &MetaItem, + item: &Item, + push: |P<Item>|) { + fn cs_total_eq_assert(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { cs_same_method(|cx, span, exprs| { // create `a.<method>(); b.<method>(); c.<method>(); ...` // (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<MetaItem>, - item: Gc<Item>, - push: |Gc<Item>|) { + mitem: &MetaItem, + item: &Item, + push: |P<Item>|) { 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<ast::Expr> { + self_arg_tags: &[ast::Ident]) -> P<ast::Expr> { 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<Expr> { + substr: &Substructure) -> P<Expr> { let test_id = cx.ident_of("__test"); let equals_path = cx.path_global(span, vec!(cx.ident_of("std"), |
