]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/deriving/cmp/ord.rs
auto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichton
[rust.git] / src / libsyntax / ext / deriving / cmp / ord.rs
index c41986fceef64ad546b3a72e8cda6ebc4c27f6fa..dd2f90cfa5fae9ac21880ad8a78513c6567d063d 100644 (file)
@@ -14,6 +14,7 @@
 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,31 +22,36 @@ 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: ~[borrowed_self()],
-                ret_ty: Literal(Path::new(~["bool"])),
-                inline: true,
+                args: vec!(borrowed_self()),
+                ret_ty: Literal(Path::new(vec!("bool"))),
+                attributes: attrs,
                 const_nonmatching: false,
-                combine_substructure: |cx, span, substr| cs_op($op, $equal, cx, span, substr)
+                combine_substructure: combine_substructure(|cx, span, substr| {
+                    cs_op($op, $equal, cx, span, substr)
+                })
             }
-        }
+        } }
     );
 
     let trait_def = TraitDef {
         span: span,
-        path: Path::new(~["std", "cmp", "Ord"]),
-        additional_bounds: ~[],
+        attributes: Vec::new(),
+        path: Path::new(vec!("std", "cmp", "Ord")),
+        additional_bounds: Vec::new(),
         generics: LifetimeBounds::empty(),
-        methods: ~[
+        methods: vec!(
             md!("lt", true, false),
             md!("le", true, true),
             md!("gt", false, false),
             md!("ge", false, true)
-        ]
+        )
     };
     trait_def.expand(cx, mitem, item, push)
 }