about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/clone.rs
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2014-07-06 21:19:12 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2014-07-11 17:32:18 +0200
commitc8ae44682d76bb40eb1471eeb42603eaecd0b392 (patch)
tree17350372e31066616c4d1492b3006d9bca9f06ab /src/libsyntax/ext/deriving/clone.rs
parent5d1bdc320ba5304854f409ba68060f5739bca044 (diff)
downloadrust-c8ae44682d76bb40eb1471eeb42603eaecd0b392.tar.gz
rust-c8ae44682d76bb40eb1471eeb42603eaecd0b392.zip
`O(n*k)` code-size deriving on enums (better than previous `O(n^k)`).
In the above formulas, `n` is the number of variants, and `k` is the
number of self-args fed into deriving.  In the particular case of
interest (namely `PartialOrd` and `Ord`), `k` is always 2, so we are
basically comparing `O(n)` versus `O(n^2)`.

Also, the stage is set for having *all* enum deriving codes go through
`build_enum_match_tuple` and getting rid of `build_enum_match`.

Also, seriously attempted to clean up the code itself.  Added a bunch
of comments attempting to document what I learned as I worked through
the original code and adapted it to this new strategy.
Diffstat (limited to 'src/libsyntax/ext/deriving/clone.rs')
-rw-r--r--src/libsyntax/ext/deriving/clone.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/ext/deriving/clone.rs b/src/libsyntax/ext/deriving/clone.rs
index 1a296906cc2..3164aaf98f2 100644
--- a/src/libsyntax/ext/deriving/clone.rs
+++ b/src/libsyntax/ext/deriving/clone.rs
@@ -69,7 +69,7 @@ fn cs_clone(
             ctor_ident = variant.node.name;
             all_fields = af;
         },
-        EnumNonMatching(..) => {
+        EnumNonMatching(..) | EnumNonMatchingCollapsed (..) => {
             cx.span_bug(trait_span,
                         format!("non-matching enum variants in \
                                  `deriving({})`",