Skip to content

Commit 895aab2

Browse files
Take resume argument from the right generator type
I suppose we could also just put `tcx.mk_unit()` here, but this works too
1 parent 72776e6 commit 895aab2

File tree

1 file changed

+8
-2
lines changed
  • src/librustc_mir_build/build

1 file changed

+8
-2
lines changed

src/librustc_mir_build/build/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,18 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> BodyAndCache<'_> {
8383
abi = Abi::Rust;
8484
vec![ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)]
8585
}
86-
ty::Generator(def_id, substs, _) => {
86+
ty::Generator(def_id, _, _) => {
8787
let gen_ty = tcx.body_tables(body_id).node_type(id);
88-
let resume_ty = substs.as_generator().resume_ty(def_id, tcx);
8988

9089
// The resume argument may be missing, in that case we need to provide it here.
9190
if body.params.is_empty() {
91+
let resume_ty = match gen_ty.kind {
92+
ty::Generator(_, substs, _) => {
93+
substs.as_generator().resume_ty(def_id, tcx)
94+
}
95+
_ => bug!(),
96+
};
97+
9298
vec![
9399
ArgInfo(gen_ty, None, None, None),
94100
ArgInfo(resume_ty, None, None, None),

0 commit comments

Comments
 (0)