This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit f3b9d47
committed
Auto merge of rust-lang#120392 - compiler-errors:async-bound-modifier, r=davidtwco,fmease
Introduce support for `async` bound modifier on `Fn*` traits
Adds `async` to the list of `TraitBoundModifiers`, which instructs AST lowering to map the trait to an async flavor of the trait. For now, this is only supported for `Fn*` to `AsyncFn*`, and I expect that this manual mapping via lang items will be replaced with a better system in the future.
The motivation for adding these bounds is to separate the users of async closures from the exact trait desugaring of their callable bounds. Instead of users needing to be concerned with the `AsyncFn` trait, they should be able to write `async Fn()` and it will desugar to whatever underlying trait we decide is best for the lowering of async closures.
Note: rustfmt support can be done in the rustfmt repo after a subtree sync.File tree
30 files changed
+516
-62
lines changed- compiler
- rustc_ast_lowering
- src
- rustc_ast_pretty/src/pprust
- rustc_ast/src
- rustc_expand/src
- rustc_parse
- src
- parser
- rustc_span/src
- tests/ui
- async-await/async-fn
- stats
30 files changed
+516
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
| 294 | + | |
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | | - | |
299 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
| |||
2562 | 2566 | | |
2563 | 2567 | | |
2564 | 2568 | | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
2565 | 2588 | | |
2566 | 2589 | | |
2567 | 2590 | | |
| |||
3300 | 3323 | | |
3301 | 3324 | | |
3302 | 3325 | | |
3303 | | - | |
| 3326 | + | |
3304 | 3327 | | |
3305 | 3328 | | |
3306 | 3329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
344 | | - | |
345 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
349 | 354 | | |
350 | | - | |
| 355 | + | |
351 | 356 | | |
352 | 357 | | |
353 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| |||
1311 | 1313 | | |
1312 | 1314 | | |
1313 | 1315 | | |
1314 | | - | |
| 1316 | + | |
1315 | 1317 | | |
1316 | 1318 | | |
1317 | 1319 | | |
| |||
1426 | 1428 | | |
1427 | 1429 | | |
1428 | 1430 | | |
1429 | | - | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
1430 | 1435 | | |
1431 | 1436 | | |
1432 | 1437 | | |
| |||
2019 | 2024 | | |
2020 | 2025 | | |
2021 | 2026 | | |
2022 | | - | |
| 2027 | + | |
2023 | 2028 | | |
2024 | 2029 | | |
2025 | 2030 | | |
| |||
2192 | 2197 | | |
2193 | 2198 | | |
2194 | 2199 | | |
2195 | | - | |
| 2200 | + | |
2196 | 2201 | | |
2197 | 2202 | | |
2198 | 2203 | | |
| |||
2202 | 2207 | | |
2203 | 2208 | | |
2204 | 2209 | | |
2205 | | - | |
| 2210 | + | |
2206 | 2211 | | |
2207 | 2212 | | |
2208 | 2213 | | |
| |||
2215 | 2220 | | |
2216 | 2221 | | |
2217 | 2222 | | |
2218 | | - | |
| 2223 | + | |
2219 | 2224 | | |
2220 | 2225 | | |
2221 | 2226 | | |
2222 | | - | |
| 2227 | + | |
2223 | 2228 | | |
2224 | 2229 | | |
2225 | 2230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
14 | | - | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
28 | | - | |
| 31 | + | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| |||
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
38 | 68 | | |
39 | 69 | | |
40 | 70 | | |
41 | | - | |
| 71 | + | |
42 | 72 | | |
43 | 73 | | |
44 | 74 | | |
| |||
77 | 107 | | |
78 | 108 | | |
79 | 109 | | |
80 | | - | |
| 110 | + | |
| 111 | + | |
81 | 112 | | |
82 | 113 | | |
83 | 114 | | |
| |||
88 | 119 | | |
89 | 120 | | |
90 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
91 | 130 | | |
92 | 131 | | |
93 | 132 | | |
| |||
125 | 164 | | |
126 | 165 | | |
127 | 166 | | |
| 167 | + | |
128 | 168 | | |
129 | 169 | | |
130 | 170 | | |
| |||
166 | 206 | | |
167 | 207 | | |
168 | 208 | | |
| 209 | + | |
169 | 210 | | |
170 | 211 | | |
171 | 212 | | |
| |||
180 | 221 | | |
181 | 222 | | |
182 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
183 | 228 | | |
184 | 229 | | |
185 | 230 | | |
| |||
188 | 233 | | |
189 | 234 | | |
190 | 235 | | |
191 | | - | |
192 | | - | |
193 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
194 | 242 | | |
195 | 243 | | |
196 | 244 | | |
| |||
357 | 405 | | |
358 | 406 | | |
359 | 407 | | |
| 408 | + | |
360 | 409 | | |
361 | 410 | | |
362 | 411 | | |
| |||
392 | 441 | | |
393 | 442 | | |
394 | 443 | | |
395 | | - | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
396 | 457 | | |
397 | 458 | | |
398 | 459 | | |
| |||
429 | 490 | | |
430 | 491 | | |
431 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
432 | 512 | | |
0 commit comments