diff options
Diffstat (limited to 'src/libsyntax/ext/deriving/cmp')
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/eq.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/ord.rs | 9 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totaleq.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/cmp/totalord.rs | 5 |
4 files changed, 23 insertions, 8 deletions
diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs index 975b8885de7..8a877a2a7a4 100644 --- a/src/libsyntax/ext/deriving/cmp/eq.rs +++ b/src/libsyntax/ext/deriving/cmp/eq.rs @@ -13,6 +13,7 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; +use parse::token::InternedString; pub fn expand_deriving_eq(cx: &mut ExtCtxt, span: Span, @@ -31,18 +32,20 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, } macro_rules! md ( - ($name:expr, $f:ident) => { + ($name:expr, $f:ident) => { { + let inline = cx.meta_word(span, InternedString::new("inline")); + let attrs = vec!(cx.attribute(span, inline)); MethodDef { name: $name, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec!(borrowed_self()), ret_ty: Literal(Path::new(vec!("bool"))), - inline: true, + attributes: attrs, const_nonmatching: true, combine_substructure: $f } - } + } } ); let trait_def = TraitDef { diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs index 5605c0b6107..2b2a490e5a4 100644 --- a/src/libsyntax/ext/deriving/cmp/ord.rs +++ b/src/libsyntax/ext/deriving/cmp/ord.rs @@ -14,6 +14,7 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; +use parse::token::InternedString; pub fn expand_deriving_ord(cx: &mut ExtCtxt, span: Span, @@ -21,18 +22,20 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, item: @Item, push: |@Item|) { macro_rules! md ( - ($name:expr, $op:expr, $equal:expr) => { + ($name:expr, $op:expr, $equal:expr) => { { + let inline = cx.meta_word(span, InternedString::new("inline")); + let attrs = vec!(cx.attribute(span, inline)); MethodDef { name: $name, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec!(borrowed_self()), ret_ty: Literal(Path::new(vec!("bool"))), - inline: true, + attributes: attrs, const_nonmatching: false, combine_substructure: |cx, span, substr| cs_op($op, $equal, cx, span, substr) } - } + } } ); let trait_def = TraitDef { diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs index 33512b3df5e..24e0fc73f2a 100644 --- a/src/libsyntax/ext/deriving/cmp/totaleq.rs +++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs @@ -13,6 +13,7 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; +use parse::token::InternedString; pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, span: Span, @@ -33,6 +34,11 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, substr) } + let inline = cx.meta_word(span, InternedString::new("inline")); + let hidden = cx.meta_word(span, InternedString::new("hidden")); + let doc = cx.meta_list(span, InternedString::new("doc"), vec!(hidden)); + let attrs = vec!(cx.attribute(span, inline), + cx.attribute(span, doc)); let trait_def = TraitDef { span: span, attributes: Vec::new(), @@ -46,7 +52,7 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt, explicit_self: borrowed_explicit_self(), args: vec!(), ret_ty: nil_ty(), - inline: true, + attributes: attrs, const_nonmatching: true, combine_substructure: cs_total_eq_assert } diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs index a584f8abe05..c2e52f7ef77 100644 --- a/src/libsyntax/ext/deriving/cmp/totalord.rs +++ b/src/libsyntax/ext/deriving/cmp/totalord.rs @@ -14,6 +14,7 @@ use codemap::Span; use ext::base::ExtCtxt; use ext::build::AstBuilder; use ext::deriving::generic::*; +use parse::token::InternedString; use std::cmp::{Ordering, Equal, Less, Greater}; @@ -22,6 +23,8 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt, mitem: @MetaItem, item: @Item, push: |@Item|) { + let inline = cx.meta_word(span, InternedString::new("inline")); + let attrs = vec!(cx.attribute(span, inline)); let trait_def = TraitDef { span: span, attributes: Vec::new(), @@ -35,7 +38,7 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt, explicit_self: borrowed_explicit_self(), args: vec!(borrowed_self()), ret_ty: Literal(Path::new(vec!("std", "cmp", "Ordering"))), - inline: true, + attributes: attrs, const_nonmatching: false, combine_substructure: cs_cmp } |
