about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-02 17:47:46 +0200
committerGitHub <noreply@github.com>2024-07-02 17:47:46 +0200
commit3cf567e3c010ceca94dc99400dd117384e93cbe1 (patch)
treeed940d43d8e632a857ef2ed607deeebaf0295bbd /compiler/rustc_codegen_llvm/src
parentf8f67b296915e70a67fbf4595b1f54d9d773be57 (diff)
parent90143b0be814ea70303906a81d8329b5b655c437 (diff)
downloadrust-3cf567e3c010ceca94dc99400dd117384e93cbe1.tar.gz
rust-3cf567e3c010ceca94dc99400dd117384e93cbe1.zip
Rollup merge of #127136 - compiler-errors:coroutine-closure-env-shim, r=oli-obk
Fix `FnMut::call_mut`/`Fn::call` shim for async closures that capture references

I adjusted async closures to be able to implement `Fn` and `FnMut` *even if* they capture references, as long as those references did not need to borrow data from the closure captures themselves. See #125259.

However, when I did this, I didn't actually relax an assertion in the `build_construct_coroutine_by_move_shim` shim code, which builds the `Fn`/`FnMut`/`FnOnce` implementations for async closures. Therefore, if we actually tried to *call* `FnMut`/`Fn` on async closures, it would ICE.

This PR adjusts this assertion to ensure that we only capture immutable references in closures if they implement `Fn`/`FnMut`. It also adds a bunch of tests and makes more of the async-closure tests into `build-pass` since we often care about these tests actually generating the right closure shims and stuff. I think it might be excessive to *always* use build-pass here, but 🤷 it's not that big of a deal.

Fixes #127019
Fixes #127012

r? oli-obk
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions