Commit 1eb33b9
authored
Make generated rust async futures Send (#1405)
The futures for generated rust async bindings were not always Send,
because the LoweredParams held a non-Send `*mut u8`. To fix this,
explicitly implement Send for LoweredParams. This makes the futures
compatible with more of the Rust ecosystem, eg. an axum webserver where
all handlers must be Send. This is safe, at least for now, because
the generated code is single threaded.
To make LoweredParams Send, change the type from a tuple to a struct
which we can explicitly mark as Send. This also requires moving it up a
little bit in the generated code outside of the trait impl.
Add a test that asserts the generated binding is Send.1 parent 65ee505 commit 1eb33b9
File tree
4 files changed
+74
-12
lines changed- crates/rust/src
- tests/runtime-async/async/rust-lowered-send
4 files changed
+74
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
812 | 812 | | |
813 | 813 | | |
814 | 814 | | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
815 | 841 | | |
816 | 842 | | |
817 | 843 | | |
| |||
844 | 870 | | |
845 | 871 | | |
846 | 872 | | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
| 873 | + | |
857 | 874 | | |
858 | 875 | | |
859 | 876 | | |
| |||
962 | 979 | | |
963 | 980 | | |
964 | 981 | | |
965 | | - | |
| 982 | + | |
966 | 983 | | |
967 | 984 | | |
968 | 985 | | |
| |||
974 | 991 | | |
975 | 992 | | |
976 | 993 | | |
977 | | - | |
| 994 | + | |
978 | 995 | | |
979 | 996 | | |
980 | 997 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments