1 // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 use ast::{MetaItem, Item, Expr};
13 use ext::base::ExtCtxt;
14 use ext::build::AstBuilder;
15 use ext::deriving::generic::*;
19 pub fn expand_deriving_totaleq(cx: &mut ExtCtxt,
24 fn cs_equals(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> @Expr {
25 cs_and(|cx, span, _, _| cx.expr_bool(span, false),
29 let trait_def = TraitDef {
31 attributes: Vec::new(),
32 path: Path::new(vec!("std", "cmp", "TotalEq")),
33 additional_bounds: Vec::new(),
34 generics: LifetimeBounds::empty(),
38 generics: LifetimeBounds::empty(),
39 explicit_self: borrowed_explicit_self(),
40 args: vec!(borrowed_self()),
41 ret_ty: Literal(Path::new(vec!("bool"))),
43 const_nonmatching: true,
44 combine_substructure: cs_equals
48 trait_def.expand(cx, mitem, item, push)