Commit b76df56
committed
Rewrite
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.#[derive(Identifiable)] in derives21 parent 0b0b1e8 commit b76df56
16 files changed
Lines changed: 318 additions & 414 deletions
File tree
- diesel_compile_tests/tests
- compile-fail
- ui
- diesel_derives2
- src
- tests
- diesel_derives/src
- diesel/src/macros
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1143 | 1143 | | |
1144 | 1144 | | |
1145 | 1145 | | |
1146 | | - | |
1147 | | - | |
1148 | 1146 | | |
1149 | 1147 | | |
1150 | 1148 | | |
| |||
Lines changed: 0 additions & 11 deletions
This file was deleted.
0 commit comments