-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor deriving(Encodable, Decodable) and various bugfixes #6851
Conversation
// Create the arms of the match in the method body. | ||
let mut arms = do enum_definition.variants.mapi |i, variant| { | ||
create_read_variant_arg(cx, span, i, variant) | ||
_ => fail!("expected StaticEnum or StaticStruct") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could probably be cx.bug("expected StaticEnum or StaticStruct")
. (And similarly in encodable.rs
.)
Yay, thanks for rewriting {En,De}codable, it's wonderful how much shorter it is! (It's good to see that the generic deriving code makes sense to someone other than its author. :) ) |
Just updated, and you did a great job with the refactorings! It took me a bit to get used to, but I thought it was all really well done. |
Now it uses the generic deriving code and should in theory work in all cases.
Thanks. :) I think with this last rewrite, most of the stuff in |
// We're not generating an AST that the borrow checker is expecting, | ||
// so we need to generate a unique local variable to take the | ||
// mutable loan out on, otherwise we get conflicts which don't | ||
// actually exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unfortunate :(
Several minor changes: - The clean-up I mentioned in #6851 (moving functions from deriving/mod.rs to deriving/generic.rs) - Move `expand_generic_deriving` to a method - Reimplement `deriving(Ord)` with no dependence on `Eq`
Closes #5090 by using the excellent new generic deriving code
Promotes the unreachable code attribute to a lint attribute (instead of always being a warning)
Fixes some edge cases when creating hashmaps/hashsets and also when consuming them. (fixes #5998)