]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax_ext/deriving/generic/mod.rs
only set non-ADT derive error once per attribute, not per trait
[rust.git] / src / libsyntax_ext / deriving / generic / mod.rs
index d701810e2e9f2fd9b025ae7db0c4326038beb8d4..5c1ca19d635f7dc865e94d51f98f1df19cda7216 100644 (file)
@@ -428,8 +428,9 @@ pub fn expand_ext(&self,
                         }
                     }
                     _ => {
-                        cx.span_err(mitem.span,
-                                    "`derive` may only be applied to structs, enums and unions");
+                        // Non-ADT derive is an error, but it should have been
+                        // set earlier; see
+                        // libsyntax/ext/expand.rs:MacroExpander::expand()
                         return;
                     }
                 };
@@ -448,8 +449,10 @@ pub fn expand_ext(&self,
                 push(Annotatable::Item(P(ast::Item { attrs: attrs, ..(*newitem).clone() })))
             }
             _ => {
-                cx.span_err(mitem.span,
-                            "`derive` may only be applied to structs and enums");
+                // Non-Item derive is an error, but it should have been
+                // set earlier; see
+                // libsyntax/ext/expand.rs:MacroExpander::expand()
+                return;
             }
         }
     }