Skip to content

fix(layout): pre-compute coroutine field layouts iteratively #153620

Open
weihanglo wants to merge 2 commits intorust-lang:mainfrom
weihanglo:layout-iterative
Open

fix(layout): pre-compute coroutine field layouts iteratively #153620
weihanglo wants to merge 2 commits intorust-lang:mainfrom
weihanglo:layout-iterative

Conversation

@weihanglo
Copy link
Member

When computing coroutine layout, each saved local is wrapped in MaybeUninit<T>, which chains through ManuallyDrop<T> and MaybeDangling<T> before reaching T. This adds 3 extra layout_of queries per field.

For coroutines with deeply nested field types, these extra queries push the query depth past the recursion limit.

This commit fixes the regression described in coroutine-query-depth.rs by walking all coroutine field types iteratively, collecting transitive dependencies, then computing their layouts bottom-up.

Each layout_of call then finds its dependencies already cached, and then we can bound max query depth to current_depth + 1 regardless of type nesting depth.

Fixes #152942

r? WaffleLapkin

When computing coroutine layout,
each saved local is wrapped in `MaybeUninit<T>`,
which chains through `ManuallyDrop<T>`
and `MaybeDangling<T>` before reaching `T`.
This adds 3 extra layout_of queries per field.

For coroutines with deeply nested field types,
these extra queries push the query depth past the recursion limit.

Issue: rust-lang/rust 152942
This commit fixes the regression described in oroutine-query-depth.rs
by walking all coroutine field types iteratively,
collecting transitive dependencies,
then computing their layouts bottom-up.

Each `layout_of` call then finds its dependencies already cached,
and then we can bound max query depth to `current_depth + 1`
regardless of type nesting depth.

Issue: rust-lang/rust 152942
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2026

WaffleLapkin is not on the review rotation at the moment.
They may take a while to respond.

@weihanglo weihanglo marked this pull request as ready for review March 9, 2026 17:37
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 9, 2026
Comment on lines 571 to 577
.iter()
.map(|local| {
let field_ty = EarlyBinder::bind(local.ty);
let uninit_ty = Ty::new_maybe_uninit(tcx, field_ty.instantiate(tcx, args));
cx.spanned_layout_of(uninit_ty, local.source_info.span)
})
.try_collect::<IndexVec<_, _>>()?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or the fix could be that we don't wrap it in new_maybe_uninit but then we need to set uninhabited = false in all variants. I don't know what that implies though especially for some niche optimization

@weihanglo
Copy link
Member Author

😭 it failed.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
/dev/sda15       98M  6.4M   92M   7% /boot/efi
tmpfs           1.6G   16K  1.6G   1% /run/user/1001
================================================================================

Sufficient disk space available (120898792KB >= 52428800KB). Skipping cleanup.
##[group]Run echo "[CI_PR_NUMBER=$num]"
echo "[CI_PR_NUMBER=$num]"
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
---
set -ex

# Run a subset of tests. Used to run tests in parallel in multiple jobs.

# When this job partition is run as part of PR CI, skip tidy to allow revealing more failures. The
# dedicated `tidy` job failing won't block other PR CI jobs from completing, and so tidy failures
# shouldn't inhibit revealing other failures in PR CI jobs.
if [ "$PR_CI_JOB" == "1" ]; then
  echo "PR_CI_JOB set; skipping tidy"
  SKIP_TIDY="--skip tidy"
fi

../x.py --stage 2 test \
  ${SKIP_TIDY:+$SKIP_TIDY} \
  --skip compiler \
  --skip src
#!/bin/bash

set -ex

# Run a subset of tests. Used to run tests in parallel in multiple jobs.

# When this job partition is run as part of PR CI, skip tidy to allow revealing more failures. The
# dedicated `tidy` job failing won't block other PR CI jobs from completing, and so tidy failures
# shouldn't inhibit revealing other failures in PR CI jobs.
if [ "$PR_CI_JOB" == "1" ]; then
  echo "PR_CI_JOB set; skipping tidy"
  SKIP_TIDY="--skip tidy"
fi

../x.py --stage 2 test \
  ${SKIP_TIDY:+$SKIP_TIDY} \
  --skip tests \
  --skip coverage-map \
  --skip coverage-run \
  --skip library \
  --skip tidyselftest
---
##[endgroup]
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
PR_CI_JOB set; skipping tidy
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
---
test [ui] tests/ui/abi/abi-sysv64-register-usage.rs ... ignored, ignored when the architecture is aarch64
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_disabled ... ok
test [ui] tests/ui/abi/abi-typo-unstable.rs#feature_enabled ... ok
test [ui] tests/ui/abi/anon-extern-mod.rs ... ok
test [ui] tests/ui/abi/avr-sram.rs#disable_sram ... ok
test [ui] tests/ui/abi/avr-sram.rs#has_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#aarch64 ... ok
test [ui] tests/ui/abi/avr-sram.rs#no_sram ... ok
test [ui] tests/ui/abi/arm-unadjusted-intrinsic.rs#arm ... ok
test [ui] tests/ui/abi/bad-custom.rs ... ok
test [ui] tests/ui/abi/c-stack-as-value.rs ... ok
test [ui] tests/ui/abi/c-zst.rs#aarch64-darwin ... ok
test [ui] tests/ui/abi/c-zst.rs#s390x-linux ... ok
---
test [ui] tests/ui/asm/aarch64/ttbr0_el2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#r82 ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/cfg-parse-error.rs ... ok
test [ui] tests/ui/asm/cfg.rs#reva ... ignored, only executed when the architecture is x86_64
---
test [ui] tests/ui/const-generics/occurs-check/unused-substs-2.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-3.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-4.rs ... ok
test [ui] tests/ui/const-generics/occurs-check/unused-substs-5.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic-fail.rs ... ok
test [ui] tests/ui/const-generics/ogca/basic.rs ... ok
test [ui] tests/ui/const-generics/ogca/generic-param-rhs.rs ... ok
test [ui] tests/ui/const-generics/ogca/coherence-ambiguous.rs ... ok
test [ui] tests/ui/const-generics/ogca/rhs-but-not-root.rs ... ok
test [ui] tests/ui/const-generics/opaque_types.rs ... ok
test [ui] tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs ... ok
test [ui] tests/ui/const-generics/opaque_types2.rs ... ok
test [ui] tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs#full ... ok
test [ui] tests/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.rs#min ... ok
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/windows-tcb-trash-13259.rs ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/feature-gates/feature-gate-loop-match.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-derive.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-macro-metavar-expr-concat.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-marker_trait_attr.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-mgca-type-const-syntax.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-may-dangle.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-more-maybe-bounds.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-movrs_target_feature.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/feature-gates/feature-gate-min-generic-const-args.rs ... ok
test [ui] tests/ui/feature-gates/feature-gate-min_const_fn.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-import-visibility-module.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-core.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-pick-std.rs ... ok
---
test [ui] tests/ui/layout/post-mono-layout-cycle.rs ... ok
test [ui] tests/ui/layout/randomize.rs#normal ... ok
test [ui] tests/ui/layout/randomize.rs#randomize-layout ... ok
test [ui] tests/ui/layout/null-pointer-optimization.rs ... ok
test [ui] tests/ui/layout/rigid-alias-due-to-broken-impl.rs ... ok
test [ui] tests/ui/layout/size-of-val-raw-too-big.rs ... ignored, only executed when the pointer width is 32bit (Layout computation rejects this layout for different reasons on 64-bit.)
test [ui] tests/ui/layout/reprc-power-alignment.rs ... ok
test [ui] tests/ui/layout/struct.rs ... ok
test [ui] tests/ui/layout/rust-call-abi-not-a-tuple-ice-81974.rs ... ok
test [ui] tests/ui/layout/rigid-alias-no-params.rs ... ok
---
3    |
4 LL |     async fn foo_recursive(&self, n: usize) -> T {
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ...
- LL |             self.foo_recursive(n - 1).await
-    |             ------------------------------- recursive call here
9    |
10    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
11 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args async-await/in-trait/async-recursive-generic.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/async-await/in-trait/async-recursive-generic.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/in-trait/async-recursive-generic" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/in-trait/async-recursive-generic.rs:8:5
   |
---
3    |
4 LL |     async fn foo_recursive(&self, n: usize) -> i32 {
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ...
- LL |             self.foo_recursive(n - 1).await
-    |             ------------------------------- recursive call here
9    |
10    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
11 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args async-await/in-trait/async-recursive.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/async-await/in-trait/async-recursive.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/in-trait/async-recursive" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/in-trait/async-recursive.rs:8:5
   |
---
+    |
+ LL |     async fn second(self) {
+    |     ^^^^^^^^^^^^^^^^^^^^^
+    |
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+ 
+ error: aborting due to 2 previous errors
13 
14 For more information about this error, try `rustc --explain E0733`.
15 
---
+    |
+ LL |     async fn second(self) {
+    |     ^^^^^^^^^^^^^^^^^^^^^
+    |
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+ 
+ error: aborting due to 2 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args async-await/in-trait/indirect-recursion-issue-112047.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/in-trait/indirect-recursion-issue-112047" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs:31:5
   |
---
   |
LL |     async fn second(self) {
   |     ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0733`.
------------------------------------------

---- [ui] tests/ui/async-await/in-trait/indirect-recursion-issue-112047.rs stdout end ----
---- [ui] tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/mutually-recursive-async-impl-trait-type/mutually-recursive-async-impl-trait-type.stderr`
diff of stderr:

3    |
4 LL | async fn rec_1() {
5    | ^^^^^^^^^^^^^^^^
- LL |     rec_2().await;
-    |     ------------- recursive call here
8    |
- note: which leads to this async fn
-   --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:1
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+ 
+ error[E0733]: recursion in an async fn requires boxing
+   --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
11    |
- LL | async fn rec_2() {
+ LL | async fn rec_1() {
13    | ^^^^^^^^^^^^^^^^
- LL |     rec_1().await;
-    |     ------------- ...leading to this recursive call
+    |
16    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
17 
- error: aborting due to 1 previous error
+ error: aborting due to 2 previous errors
19 
20 For more information about this error, try `rustc --explain E0733`.
21 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs:5:1
- LL | async fn rec_1() { //~ ERROR recursion in an async fn
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+ 
+ error[E0733]: recursion in an async fn requires boxing
+   --> $DIR/mutually-recursive-async-impl-trait-type.rs:5:1
+ LL | async fn rec_1() {
+    |
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+ error: aborting due to 2 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args async-await/mutually-recursive-async-impl-trait-type.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/mutually-recursive-async-impl-trait-type" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs:5:1
   |
LL | async fn rec_1() { //~ ERROR recursion in an async fn
   | ^^^^^^^^^^^^^^^^
   |
   = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future

error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/mutually-recursive-async-impl-trait-type.rs:5:1
   |
LL | async fn rec_1() { //~ ERROR recursion in an async fn
   | ^^^^^^^^^^^^^^^^
   |
   = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0733`.
------------------------------------------
---
To only update this specific test, also pass `--test-args async-await/recursive-async-impl-trait-type.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/async-await/recursive-async-impl-trait-type.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/async-await/recursive-async-impl-trait-type" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/async-await/recursive-async-impl-trait-type.rs:5:1
   |
---
To only update this specific test, also pass `--test-args impl-trait/non-defining-uses/ice-issue-146191.rs`

error in revision `current`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "current" "--check-cfg" "cfg(test,FALSE,current,next)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/impl-trait/non-defining-uses/ice-issue-146191.current" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024"
stdout: none
--- stderr -------------------------------
error[E0277]: the trait bound `(): ReturnsSend` is not satisfied
##[error]  --> /checkout/tests/ui/impl-trait/non-defining-uses/ice-issue-146191.rs:6:52
   |
---
To only update this specific test, also pass `--test-args impl-trait/recursive-coroutine-indirect.rs`

error in revision `current`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/impl-trait/recursive-coroutine-indirect.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "current" "--check-cfg" "cfg(test,FALSE,current,next)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/impl-trait/recursive-coroutine-indirect.current" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in a coroutine requires boxing
##[error]  --> /checkout/tests/ui/impl-trait/recursive-coroutine-indirect.rs:8:18
   |
LL |     #[coroutine] move || { //~ ERROR recursion in a coroutine requires boxing
   |                  ^^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0733`.
------------------------------------------

---- [ui] tests/ui/impl-trait/recursive-coroutine-indirect.rs#current stdout end ----
---- [ui] tests/ui/impl-trait/recursive-coroutine-indirect.rs#next stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/impl-trait/recursive-coroutine-indirect.next/recursive-coroutine-indirect.next.stderr`
diff of stderr:

3    |
4 LL |     #[coroutine] move || {
5    |                  ^^^^^^^
---
To only update this specific test, also pass `--test-args impl-trait/recursive-coroutine-indirect.rs`

error in revision `next`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/impl-trait/recursive-coroutine-indirect.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "next" "--check-cfg" "cfg(test,FALSE,current,next)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/impl-trait/recursive-coroutine-indirect.next" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Znext-solver"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in a coroutine requires boxing
##[error]  --> /checkout/tests/ui/impl-trait/recursive-coroutine-indirect.rs:8:18
   |
LL |     #[coroutine] move || { //~ ERROR recursion in a coroutine requires boxing
   |                  ^^^^^^^

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0733`.
---
6 LL | |     where
7 LL | |         T: IntoIterator<Item = ()>,
8    | |___________________________________^
- LL |       {
- LL |           Blah::iter(self, iterator).await
-    |           -------------------------------- recursive call here
12    |
13    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
14 


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args layout/post-mono-layout-cycle-2.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/layout/post-mono-layout-cycle-2.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/layout/post-mono-layout-cycle-2" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async fn requires boxing
##[error]  --> /checkout/tests/ui/layout/post-mono-layout-cycle-2.rs:28:5
   |
---
diff of stderr:

2   --> $DIR/indirect-recursion-issue-112047.rs:21:9
3    |
4 LL |         async move { recur(self).await; }
-    |         ^^^^^^^^^^   ----------------- recursive call here
+    |         ^^^^^^^^^^
6    |
- note: which leads to this async fn
-   --> $DIR/indirect-recursion-issue-112047.rs:13:1
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+ 
+ error[E0733]: recursion in an async block requires boxing
+   --> $DIR/indirect-recursion-issue-112047.rs:21:9
9    |
- LL | async fn recur(t: impl Recur) {
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- LL |     t.recur().await;
-    |     --------------- ...leading to this recursive call
+ LL |         async move { recur(self).await; }
+    |         ^^^^^^^^^^
+    |
14    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
15 
- error: aborting due to 1 previous error
+ error: aborting due to 2 previous errors
17 
18 For more information about this error, try `rustc --explain E0733`.
---
+    = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
+ 
+ error[E0733]: recursion in an async block requires boxing
+   --> $DIR/indirect-recursion-issue-112047.rs:21:9
+ LL |         async move { recur(self).await; }
+    |         ^^^^^^^^^^
+    |
+    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+ error: aborting due to 2 previous errors


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args type-alias-impl-trait/indirect-recursion-issue-112047.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/type-alias-impl-trait/indirect-recursion-issue-112047" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"
stdout: none
--- stderr -------------------------------
error[E0733]: recursion in an async block requires boxing
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs:21:9
   |
LL |         async move { recur(self).await; }
   |         ^^^^^^^^^^
   |
   = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future

error[E0733]: recursion in an async block requires boxing
##[error]  --> /checkout/tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs:21:9
   |
LL |         async move { recur(self).await; }
   |         ^^^^^^^^^^
   |
   = note: a recursive `async fn` call must introduce indirection such as `Box::pin` to avoid an infinitely sized future
   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0733`.
------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query depth limit overflow when building matrix_sdk

4 participants