Skip to content

Conversation

cjgillot
Copy link
Contributor

This actually is one of use cases unsafe binder types are meant to address. This PR tries to use them as so.

The implementation of unsafe binders is still incomplete, so this PR is mostly for experimentation and not meant to be merged.

r? @compiler-errors

@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 14, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2025

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

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
diff of stderr:

5    |                      -- the expected `async` closure body
6 LL |
7 LL |     let () = x();
-    |         ^^   --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15634 ~ core[1112]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15635 ~ core[1112]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15634 ~ core[1112]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15635 ~ core[1112]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
+    |         ^^   --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
9    |         |
10    |         expected `async` closure body, found `()`
11    |

-    = note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15634 ~ core[1112]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15635 ~ core[1112]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15634 ~ core[1112]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15635 ~ core[1112]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
+    = note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
13                          found unit type `()`
14 
15 error: aborting due to 1 previous error


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/async-closures/def-path.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/async-closures/def-path.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/async-closures/def-path" "-A" "unused" "-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" "-Zverbose-internals"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/async-await/async-closures/def-path.rs:7:9
   |
LL |     let x = async || {};
   |                      -- the expected `async` closure body
LL |     //~^ NOTE the expected `async` closure body
LL |     let () = x();
   |         ^^   --- this expression has type `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
   |         |
   |         expected `async` closure body, found `()`
   |
   = note: expected `async` closure body `{static main::{closure#0}::{closure#0}<?15t> upvar_tys=?14t resume_ty=unsafe<Region(BrNamed(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a))), Region(BrNamed(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b)))> &'^0.Named(DefId(2:15675 ~ core[7629]::future::ResumeTy::'a)) mut Context<'^1.Named(DefId(2:15676 ~ core[7629]::future::ResumeTy::'b))> yield_ty=() return_ty=()}`
                         found unit type `()`

error: aborting due to 1 previous error

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

@compiler-errors
Copy link
Member

Maybe let's crater this?

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 15, 2025
[EXPERIMENT] Replace ResumeTy with an unsafe binder ty.
@rust-bors
Copy link

rust-bors bot commented Sep 15, 2025

💥 Test timed out after 21600s

@oli-obk
Copy link
Contributor

oli-obk commented Sep 15, 2025

@bors try

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 15, 2025
[EXPERIMENT] Replace ResumeTy with an unsafe binder ty.
@rust-bors
Copy link

rust-bors bot commented Sep 15, 2025

☀️ Try build successful (CI)
Build commit: 342ed2e (342ed2e8608ee307743c341962b427652cdb06e9, parent: d1ed52b1f5b78bf66127b670af813b84d57aeedb)

@oli-obk
Copy link
Contributor

oli-obk commented Sep 15, 2025

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-146562 created and queued.
🤖 Automatically detected try build 342ed2e
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 15, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-146562 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-146562 is completed!
📊 2 regressed and 7 fixed (699587 total)
📊 1491 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-146562/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 17, 2025
@bors
Copy link
Collaborator

bors commented Sep 17, 2025

☔ The latest upstream changes (presumably #146666) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot
Copy link
Contributor Author

@craterbot
Copy link
Collaborator

👌 Experiment pr-146562-1 created and queued.
🤖 Automatically detected try build 342ed2e
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-146562-1 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-146562-1 is completed!
📊 0 regressed and 0 fixed (1471 total)
📊 108 spurious results on the retry-regessed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-146562-1/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Sep 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants