Skip to content

Commit 84dd07a

Browse files
Simplify implicit resume argument
1 parent fb66b9e commit 84dd07a

File tree

1 file changed

+3
-9
lines changed
  • src/librustc_mir_build/build

1 file changed

+3
-9
lines changed

src/librustc_mir_build/build/mod.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,15 @@ 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, _, _) => {
86+
ty::Generator(..) => {
8787
let gen_ty = tcx.body_tables(body_id).node_type(id);
8888

8989
// The resume argument may be missing, in that case we need to provide it here.
90+
// It will always be `()` in this case.
9091
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-
9892
vec![
9993
ArgInfo(gen_ty, None, None, None),
100-
ArgInfo(resume_ty, None, None, None),
94+
ArgInfo(tcx.mk_unit(), None, None, None),
10195
]
10296
} else {
10397
vec![ArgInfo(gen_ty, None, None, None)]

0 commit comments

Comments
 (0)