rust/compiler/rustc_codegen_ssa/src
Matthias Krüger 3cf567e3c0
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
2024-07-02 17:47:46 +02:00
..
back linker: Bail out of rpath logic early if the target doesn't support rpath 2024-07-01 14:19:51 +03:00
debuginfo Add Ty to ConstKind::Value 2024-06-05 22:25:41 +01:00
mir Rollup merge of #127136 - compiler-errors:coroutine-closure-env-shim, r=oli-obk 2024-07-02 17:47:46 +02:00
traits Fix doc comment 2024-06-21 19:30:26 +00:00
assert_module_sources.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
base.rs Only compute vtable information during codegen 2024-06-14 20:35:45 -04:00
codegen_attrs.rs Rollup merge of #124741 - nebulark:patchable-function-entries-pr, r=estebank,workingjubilee 2024-06-28 08:34:07 +02:00
common.rs ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
errors.rs coverage: Tighten validation of #[coverage(off)] and #[coverage(on)] 2024-06-24 20:15:01 +10:00
lib.rs Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
meth.rs Move vcall_visibility_metadata optimization hint out of a debuginfo generation method 2024-06-21 19:26:06 +00:00
mono_item.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
size_of_val.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
target_features.rs Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00