rust/src/tools
bors dc641039d2 Auto merge of #117703 - compiler-errors:recursive-async, r=lcnr
Support async recursive calls (as long as they have indirection)

Before #101692, we stored coroutine witness types directly inside of the coroutine. That means that a coroutine could not contain itself (as a witness field) without creating a cycle in the type representation of the coroutine, which we detected with the `OpaqueTypeExpander`, which is used to detect cycles when expanding opaque types after that are inferred to contain themselves.

After `-Zdrop-tracking-mir` was stabilized, we no longer store these generator witness fields directly, but instead behind a def-id based query. That means there is no technical obstacle in the compiler preventing coroutines from containing themselves per se, other than the fact that for a coroutine to have a non-infinite layout, it must contain itself wrapped in a layer of allocation indirection (like a `Box`).

This means that it should be valid for this code to work:

```
async fn async_fibonacci(i: u32) -> u32 {
    if i == 0 || i == 1 {
        i
    } else {
        Box::pin(async_fibonacci(i - 1)).await
          + Box::pin(async_fibonacci(i - 2)).await
    }
}
```

Whereas previously, you'd need to coerce the future to `Pin<Box<dyn Future<Output = ...>>` before `await`ing it, to prevent the async's desugared coroutine from containing itself across as await point.

This PR does two things:
1. Only report an error if an opaque expansion cycle is detected *not* through coroutine witness fields.
    * Instead, if we find an opaque cycle through coroutine witness fields, we compute the layout of the coroutine. If that results in a cycle error, we report it as a recursive async fn.
4. Reworks the way we report layout errors having to do with coroutines, to make up for the diagnostic regressions introduced by (1.). We actually do even better now, pointing out the call sites of the recursion!
2024-01-09 07:20:50 +00:00
..
build-manifest Add riscv32 imafc bare metal target 2023-12-05 11:05:52 +00:00
build_helper rename github_repository to git_repository 2023-11-06 15:53:32 +01:00
bump-stage0 make x.py clippy download and use beta clippy 2023-12-16 15:24:59 -05:00
cargo@2ce45605d9 Update cargo 2024-01-05 23:11:26 -05:00
cargotest Don't ask for a specific branch in cargotest 2023-12-04 12:11:44 +02:00
clippy Rustdoc and Clippy stop misusing Key for Ty -> (adt) DefId 2024-01-08 20:30:10 +00:00
collect-license-metadata Fix generate-copyright tool. 2023-11-27 11:03:53 +00:00
compiletest Rollup merge of #119619 - onur-ozkan:panic-abort-mir-opt, r=oli-obk 2024-01-09 05:33:22 +01:00
coverage-dump Add tool src/tools/coverage-dump for use by some new coverage tests 2023-09-05 11:11:48 +10:00
error_index_generator Rename EarlyErrorHandler as EarlyDiagCtxt. 2023-12-18 16:06:21 +11:00
expand-yaml-anchors
generate-copyright Fix generate-copyright tool. 2023-11-27 11:03:53 +00:00
generate-windows-sys Update windows-bindgen 2023-11-17 12:18:04 +00:00
html-checker
jsondocck jsondocck: bump jsonpath to 0.3, dropping few dup dependencies 2023-11-18 12:56:54 +03:00
jsondoclint rustdoc: Rename typedef to type alias in jsondoclint 2023-08-23 11:47:35 -07:00
linkchecker linkchecker: Remove unneeded FIXME about intra-doc links 2023-08-06 13:28:43 +02:00
lint-docs
lld-wrapper linker: Remove -Zgcc-ld option 2023-10-08 10:05:25 +03:00
miri Auto merge of #3261 - RalfJung:jemalloc, r=RalfJung 2024-01-08 07:41:42 +00:00
miropt-test-tools Allow to run filecheck in mir-opt tests. 2023-10-19 15:51:52 +00:00
opt-dist Partial Revert: "Auto merge of #117018 - Kobzol:opt-dist-cargo-stage0" 2023-10-23 16:10:52 +02:00
remote-test-client
remote-test-server
replace-version-placeholder
rls
rust-analyzer Merge commit 'af40101841' into sync-from-ra 2024-01-08 11:29:25 +02:00
rust-demangler
rust-installer bump some deps 2023-11-07 15:33:59 +03:00
rustbook
rustdoc
rustdoc-gui Improve display of parallel jobs in rustdoc-gui tester script 2023-10-16 20:16:08 +02:00
rustdoc-gui-test
rustdoc-js rustdoc-search: remove parallel searchWords array 2023-12-15 16:26:35 -07:00
rustdoc-themes Ensure build/tmp exists in rustdoc_themes::get_themes 2023-09-20 08:31:33 +02:00
rustfmt Make DiagnosticBuilder::emit consuming. 2024-01-08 15:24:49 +11:00
suggest-tests Add test suggestions for mir-opt and coverage 2023-11-16 14:02:51 +11:00
tidy Delete unused makefile in tests/ui 2024-01-07 20:48:31 +01:00
tier-check
unicode-table-generator
unstable-book-gen
x
cherry-pick.sh
publish_toolstate.py