Skip to content
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

Rewrite #[derive(Identifiable)] in derives2 #1526

Merged
merged 1 commit into from
Feb 3, 2018
Merged

Conversation

sgrif
Copy link
Member

@sgrif sgrif commented Feb 2, 2018

The actual derive itself is pretty straightforward (this isn't exactly a
complex trait). Most of the tests were brought over from the macro
tests. I dropped a few that were obviously redundant (that were testing
our struct parser not the derive). I've added a few for things that
weren't working before (and were actually broken) like tuple structs.

This does contain what is technically a breaking change in behavior. The
old implementation would look for the PK fields by field name rather
than column name. I consider this a bug. Everything else links by column
name, and if we actually went by field name, tuple structs couldn't
work.

I didn't add explicit UI tests for the table not being in scope, or for
bad syntax, as those are redundant with AsChangeset. We did have to do a
little bit of dancing to work around
rust-lang/rust#47941 when the PK names cause
an error.

The actual derive itself is pretty straightforward (this isn't exactly a
complex trait). Most of the tests were brought over from the macro
tests. I dropped a few that were obviously redundant (that were testing
our struct parser not the derive). I've added a few for things that
weren't working before (and were actually broken) like tuple structs.

This does contain what is technically a breaking change in behavior. The
old implementation would look for the PK fields by field name rather
than column name. I consider this a bug. Everything else links by column
name, and if we actually went by field name, tuple structs couldn't
work.

I didn't add explicit UI tests for the table not being in scope, or for
bad syntax, as those are redundant with AsChangeset. We did have to do a
little bit of dancing to work around
rust-lang/rust#47941 when the PK names cause
an error.
@sgrif sgrif requested a review from a team February 2, 2018 21:20
@sgrif sgrif merged commit 14887fc into master Feb 3, 2018
@sgrif sgrif deleted the sg-rewrite-identifiable branch February 3, 2018 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants