diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-24 21:12:49 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-03-24 21:12:49 -0400 |
| commit | b7d67eace78d5e660df93b513326650fe8226a96 (patch) | |
| tree | 5c2a7721c52fcd60e55331aee0e47192a93377f8 /compiler/rustc_const_eval/src | |
| parent | 847fd88df724280880c705848ba1a120ce15e020 (diff) | |
| download | rust-b7d67eace78d5e660df93b513326650fe8226a96.tar.gz rust-b7d67eace78d5e660df93b513326650fe8226a96.zip | |
Require coroutine kind type to be passed to TyCtxt::coroutine_layout
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 08e3e42a82e..b085e4e76a1 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -101,9 +101,9 @@ impl<'tcx> MirPass<'tcx> for Validator { } // Enforce that coroutine-closure layouts are identical. - if let Some(layout) = body.coroutine_layout() + if let Some(layout) = body.coroutine_layout_raw() && let Some(by_move_body) = body.coroutine_by_move_body() - && let Some(by_move_layout) = by_move_body.coroutine_layout() + && let Some(by_move_layout) = by_move_body.coroutine_layout_raw() { if layout != by_move_layout { // If this turns out not to be true, please let compiler-errors know. @@ -715,13 +715,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { // args of the coroutine. Otherwise, we prefer to use this body // since we may be in the process of computing this MIR in the // first place. - let gen_body = if def_id == self.caller_body.source.def_id() { - self.caller_body + let layout = if def_id == self.caller_body.source.def_id() { + // FIXME: This is not right for async closures. + self.caller_body.coroutine_layout_raw() } else { - self.tcx.optimized_mir(def_id) + self.tcx.coroutine_layout(def_id, args.as_coroutine().kind_ty()) }; - let Some(layout) = gen_body.coroutine_layout() else { + let Some(layout) = layout else { self.fail( location, format!("No coroutine layout for {parent_ty:?}"), |
