]> git.proxmox.com Git - rustc.git/blobdiff - src/libsyntax_ext/deriving/default.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / libsyntax_ext / deriving / default.rs
index 9df3db938b1f918fba8649a251f19ff34aa2511e..b15fd2b49a65547c241ed463f0c5a55767754f71 100644 (file)
@@ -32,6 +32,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
         additional_bounds: Vec::new(),
         generics: LifetimeBounds::empty(),
         is_unsafe: false,
+        supports_unions: false,
         methods: vec![MethodDef {
                           name: "default",
                           generics: LifetimeBounds::empty(),
@@ -57,8 +58,8 @@ fn default_substructure(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructur
     return match *substr.fields {
         StaticStruct(_, ref summary) => {
             match *summary {
-                Unnamed(ref fields) => {
-                    if fields.is_empty() {
+                Unnamed(ref fields, is_tuple) => {
+                    if !is_tuple {
                         cx.expr_ident(trait_span, substr.type_ident)
                     } else {
                         let exprs = fields.iter().map(|sp| default_call(*sp)).collect();