Commit 1c5cebf
committed
[project] Distinguish structs/union/enums
For the `HasField` `VARIANT_ID` and `FIELD_ID` constants, use `i128`
instead of `u128`. For structs and unions, set `VARIANT_ID = -1` and
`VARIANT_ID = -2` (respectively) instead of 0. This ensures that we will
never accidentally confuse the first (ie, 0th) variant of an enum with a
struct or union. It also paves the way for us to define methods which
only support a subset of structs/unions/enums.
Makes progress on #196, #2856
gherrit-pr-id: G03596047b3e8a9931799295d1e707540561c4e461 parent 77f1c47 commit 1c5cebf
File tree
7 files changed
+235
-205
lines changed- src
- pointer
- util
- zerocopy-derive/src
7 files changed
+235
-205
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
821 | | - | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
822 | 824 | | |
823 | 825 | | |
824 | 826 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
1092 | 1103 | | |
1093 | 1104 | | |
1094 | 1105 | | |
| |||
1099 | 1110 | | |
1100 | 1111 | | |
1101 | 1112 | | |
1102 | | - | |
1103 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
1104 | 1119 | | |
1105 | 1120 | | |
1106 | 1121 | | |
1107 | | - | |
| 1122 | + | |
1108 | 1123 | | |
1109 | 1124 | | |
1110 | 1125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
204 | 204 | | |
205 | 205 | | |
206 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
553 | 553 | | |
554 | 554 | | |
555 | 555 | | |
556 | | - | |
| 556 | + | |
557 | 557 | | |
558 | 558 | | |
559 | 559 | | |
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
| 587 | + | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
| 458 | + | |
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
758 | 758 | | |
759 | 759 | | |
760 | 760 | | |
761 | | - | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
762 | 768 | | |
763 | 769 | | |
764 | 770 | | |
765 | 771 | | |
766 | 772 | | |
767 | | - | |
768 | | - | |
| 773 | + | |
769 | 774 | | |
770 | 775 | | |
771 | 776 | | |
| |||
844 | 849 | | |
845 | 850 | | |
846 | 851 | | |
847 | | - | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
848 | 857 | | |
849 | 858 | | |
850 | 859 | | |
| |||
905 | 914 | | |
906 | 915 | | |
907 | 916 | | |
908 | | - | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
909 | 922 | | |
910 | 923 | | |
911 | 924 | | |
| |||
0 commit comments