Commit 145be84
Support special import names for unit futures/streams (#2390)
* Support special import names for unit futures/streams
This commit enhances `wit-component`'s import detection to support
"unit" `future` and `stream` types which don't have a payload in a
special way. Previously it was required that these types were mentioned
in some WIT somewhere to get connected to a function, but now it's
possible to import these intrinsics directly even if the type isn't
mentioned in WIT.
The motivation for this change is to support guest language async
runtimes which are world-agnostic to still operate on unit
futures/streams as necessary without binding them to any particular WIT
import or export. For example it's expected that unit streams are a
primitive for inter-task communication in the component model.
* Update crates/wit-component/src/validation.rs
Co-authored-by: Joel Dice <[email protected]>
---------
Co-authored-by: Joel Dice <[email protected]>1 parent 0f3f212 commit 145be84
File tree
8 files changed
+291
-66
lines changed- crates/wit-component
- src
- encoding
- tests/components/async-unit-builtins
8 files changed
+291
-66
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
1337 | 1339 | | |
1338 | 1340 | | |
1339 | 1341 | | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
1354 | 1357 | | |
1355 | 1358 | | |
1356 | 1359 | | |
| |||
1506 | 1509 | | |
1507 | 1510 | | |
1508 | 1511 | | |
1509 | | - | |
| 1512 | + | |
1510 | 1513 | | |
1511 | 1514 | | |
1512 | 1515 | | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
1516 | | - | |
1517 | 1516 | | |
1518 | | - | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
1519 | 1525 | | |
1520 | 1526 | | |
1521 | 1527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
372 | 374 | | |
373 | 375 | | |
374 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
375 | 397 | | |
376 | 398 | | |
377 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
399 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
159 | 176 | | |
160 | 177 | | |
161 | 178 | | |
162 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
163 | 184 | | |
164 | 185 | | |
165 | 186 | | |
166 | 187 | | |
167 | 188 | | |
168 | 189 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | 190 | | |
184 | 191 | | |
185 | 192 | | |
| |||
1994 | 2001 | | |
1995 | 2002 | | |
1996 | 2003 | | |
1997 | | - | |
1998 | | - | |
1999 | | - | |
2000 | | - | |
2001 | | - | |
2002 | | - | |
2003 | | - | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
2007 | | - | |
2008 | | - | |
2009 | | - | |
2010 | | - | |
2011 | | - | |
2012 | | - | |
2013 | | - | |
2014 | | - | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
2015 | 2041 | | |
2016 | 2042 | | |
2017 | 2043 | | |
2018 | 2044 | | |
2019 | 2045 | | |
2020 | | - | |
2021 | 2046 | | |
2022 | 2047 | | |
2023 | 2048 | | |
| |||
2631 | 2656 | | |
2632 | 2657 | | |
2633 | 2658 | | |
2634 | | - | |
2635 | | - | |
| 2659 | + | |
| 2660 | + | |
2636 | 2661 | | |
2637 | 2662 | | |
2638 | 2663 | | |
2639 | 2664 | | |
2640 | 2665 | | |
2641 | | - | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
2642 | 2673 | | |
2643 | 2674 | | |
2644 | 2675 | | |
| |||
0 commit comments