1
Fork 0

Rollup merge of #111533 - clubby789:drop-tracking-error, r=oli-obk

Handle error body in generator layout

Fixes #111468

I feel like making this query return `Option<GeneratorLayout>` might be better but had some issues with that approach
This commit is contained in:
Matthias Krüger 2023-05-16 20:12:16 +02:00 committed by GitHub
commit 426dbcdf92
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 49 additions and 11 deletions

View file

@ -1397,7 +1397,7 @@ fn create_cases<'tcx>(
pub(crate) fn mir_generator_witnesses<'tcx>(
tcx: TyCtxt<'tcx>,
def_id: LocalDefId,
) -> GeneratorLayout<'tcx> {
) -> Option<GeneratorLayout<'tcx>> {
assert!(tcx.sess.opts.unstable_opts.drop_tracking_mir);
let (body, _) = tcx.mir_promoted(def_id);
@ -1410,6 +1410,7 @@ pub(crate) fn mir_generator_witnesses<'tcx>(
// Get the interior types and substs which typeck computed
let movable = match *gen_ty.kind() {
ty::Generator(_, _, movability) => movability == hir::Movability::Movable,
ty::Error(_) => return None,
_ => span_bug!(body.span, "unexpected generator type {}", gen_ty),
};
@ -1425,7 +1426,7 @@ pub(crate) fn mir_generator_witnesses<'tcx>(
check_suspend_tys(tcx, &generator_layout, &body);
generator_layout
Some(generator_layout)
}
impl<'tcx> MirPass<'tcx> for StateTransform {