Commit Graph

114 Commits

Author SHA1 Message Date
Brian Carroll
997daacf66
Update some Zig code to 0.9.1 2022-05-15 11:10:41 +01:00
Richard Feldman
d26f6f600f
Merge pull request #3065 from rtfeldman/bindgen-recursive-tag-unions
Bindgen unwrapped pointer recursive tag unions
2022-05-14 16:09:40 -04:00
Richard Feldman
e10bfe9fa1
Rename MyTagUnion to NonRecursive in examples 2022-05-14 10:25:13 -04:00
Folkert
c161140aec
Merge remote-tracking branch 'origin/trunk' into more-tyck 2022-05-14 14:48:54 +02:00
Richard Feldman
122ed0305d
Drop unused fold methods 2022-05-14 01:48:31 -04:00
Richard Feldman
15c41ccc3a
Use string interpolation over indoc 2022-05-14 01:46:49 -04:00
Richard Feldman
90576a8c38
Make cons list of ints work 2022-05-14 01:15:34 -04:00
Richard Feldman
2d866c6cb6
Add failing test for recursive int cons list 2022-05-14 01:07:18 -04:00
Richard Feldman
e5be25e356
Bindgen a Debug impl for unwrapped pointers 2022-05-14 01:07:17 -04:00
Richard Feldman
170518a6b2
Add nullable unwrapped impls 2022-05-14 00:49:13 -04:00
Richard Feldman
aa193146d4
Drop unused rec_var 2022-05-14 00:42:53 -04:00
Richard Feldman
de14c9b979
Correctly unwrap cons list payloads in bindgen 2022-05-13 23:55:13 -04:00
Richard Feldman
bb005f58cd
Expand write_nullable_unwrapped 2022-05-13 23:18:14 -04:00
Richard Feldman
3584122b53
Bindgen transparent wrapper for single-field records 2022-05-13 23:11:32 -04:00
Richard Feldman
3f2f04c9a8
Drop unnecessary conditional 2022-05-13 23:09:51 -04:00
Richard Feldman
3fa137d19f
Revert "Bindgen single-field record and unions as unwrapped"
This reverts commit 4c2e6471a6.
2022-05-13 23:09:21 -04:00
Richard Feldman
4c2e6471a6
Bindgen single-field record and unions as unwrapped 2022-05-13 23:06:13 -04:00
Richard Feldman
2b73307af7
Revert "Try out returning Option<TypeId> from add_type"
This reverts commit 1937f78509.
2022-05-13 22:52:39 -04:00
Richard Feldman
1937f78509
Try out returning Option<TypeId> from add_type 2022-05-13 22:52:28 -04:00
Richard Feldman
cbd21519f5
Let non-enumeration tag unions derive all but Debug 2022-05-13 22:36:30 -04:00
Richard Feldman
1138d62e52
Start implementing write_nullable_unwrapped 2022-05-13 22:36:27 -04:00
Richard Feldman
3d1bc0906b
Extract write_discriminant 2022-05-13 22:25:09 -04:00
Richard Feldman
37a2e1df29
Extract write_type 2022-05-13 22:24:39 -04:00
Richard Feldman
b2b5f8cf93
Improve test for unwrapped nullable tag union bindgen 2022-05-13 21:40:29 -04:00
Richard Feldman
d687c2397b
Avoid some allocations 2022-05-13 16:48:12 -04:00
Richard Feldman
d9cdcb7635
Create nested RocTagUnion enum in bindgen types 2022-05-13 16:39:03 -04:00
Richard Feldman
7771b2090c
Partially bindgen recursive tag unions 2022-05-13 12:19:42 -04:00
Richard Feldman
ed769a7a3b
Simplify bindgen for into_ methods in tag unions
Thanks for the improvement @folkertdev!
2022-05-12 17:03:16 -04:00
Richard Feldman
ce6c7f6024
Fix "Cannot move out of drop" problem for into_Foo 2022-05-12 15:25:52 -04:00
Richard Feldman
49cf2a8483
Bindgen as_Foo and into_Foo for variants 2022-05-12 15:04:24 -04:00
Richard Feldman
1de7d8abb6
Bindgen constructors for no-payload tags 2022-05-12 14:27:17 -04:00
Richard Feldman
e03a44f844
Don't bindgen a variant() accessor 2022-05-12 14:24:43 -04:00
Richard Feldman
2864471f13
Bindgen tag after union, not the other way around 2022-05-12 14:20:56 -04:00
Ayaz Hafiz
3f0449292d
My bad 2022-05-11 14:57:03 -04:00
Ayaz Hafiz
710a10a29c
Check for invalid cycles after type solving recursive defs
Disallow cycles that pass through a non-function value. Since we
evaluate eagerly, having one such cycle means there is at least one path
in the program that (likely) has unbounded recursion. Of course we can't
be certain (halting problem), but it's very likely, and avoids stuff
like #1926. Also, mono (as it's done today) won't work if things in a
cycle aren't functions.

Closes #1926
2022-05-11 14:57:01 -04:00
Richard Feldman
d3383d92aa
Drop unused crate dependency on const_format 2022-05-11 10:54:09 -04:00
Richard Feldman
749e4b25c7
Bindgen Debug impl for tag unions 2022-05-11 10:47:59 -04:00
Richard Feldman
a74c7c3009
Drop some incorrect comments 2022-05-11 10:47:59 -04:00
Richard Feldman
98e2902088
Bindgen Clone and Copy impls for tag unions 2022-05-11 10:47:59 -04:00
Richard Feldman
60fce86326
Use core over std in bindgen 2022-05-11 10:47:58 -04:00
Richard Feldman
3932300abd
Revise generated tag union code a bit 2022-05-11 10:47:58 -04:00
Richard Feldman
b874e4f7de
Explicitly bindgen enumeration values
This makes it clearer that you can't generate them
and then add your own names wherever you want!
2022-05-11 10:47:58 -04:00
Richard Feldman
55a69c69b0
Enumerations can't derive Default 2022-05-11 10:47:58 -04:00
Richard Feldman
1beb27d6d5
Bindgen PartialOrd and Ord instances for tag unions 2022-05-11 10:47:58 -04:00
Richard Feldman
2fb52af432
Bindgen PartialEq and Eq instances for tag unions 2022-05-11 10:47:58 -04:00
Richard Feldman
bf59119bf3
Allow custom indentation in write_impl_tags 2022-05-11 10:47:58 -04:00
Richard Feldman
fe591450df
Drop some obsolete comments 2022-05-11 10:47:57 -04:00
Richard Feldman
3cfb32a3f8
Extract write_impl_tags 2022-05-11 10:47:57 -04:00
Richard Feldman
00253c6fd9
Don't try to derive impls for tag unions 2022-05-11 10:47:57 -04:00
Richard Feldman
9a22d7632a
Bindgen a Drop implementation for a tag union 2022-05-11 10:47:57 -04:00