diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-02 17:47:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-02 17:47:46 +0200 |
| commit | 3cf567e3c010ceca94dc99400dd117384e93cbe1 (patch) | |
| tree | ed940d43d8e632a857ef2ed607deeebaf0295bbd /compiler/rustc_codegen_ssa/src | |
| parent | f8f67b296915e70a67fbf4595b1f54d9d773be57 (diff) | |
| parent | 90143b0be814ea70303906a81d8329b5b655c437 (diff) | |
| download | rust-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_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/locals.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/locals.rs b/compiler/rustc_codegen_ssa/src/mir/locals.rs index a6c873e195e..5190021c005 100644 --- a/compiler/rustc_codegen_ssa/src/mir/locals.rs +++ b/compiler/rustc_codegen_ssa/src/mir/locals.rs @@ -47,7 +47,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let expected_ty = self.monomorphize(self.mir.local_decls[local].ty); if expected_ty != op.layout.ty { warn!( - "Unexpected initial operand type: expected {expected_ty:?}, found {:?}.\ + "Unexpected initial operand type:\nexpected {expected_ty:?},\nfound {:?}.\n\ See <https://github.com/rust-lang/rust/issues/114858>.", op.layout.ty ); |
