Skip to content

Commit 3fc328d

Browse files
Normalize generator interior type before erasing
1 parent 02ad984 commit 3fc328d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/rustc_typeck/src/check/generator_interior.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ pub fn resolve_interior<'a, 'tcx>(
218218
.filter_map(|mut cause| {
219219
// Erase regions and canonicalize late-bound regions to deduplicate as many types as we
220220
// can.
221-
let erased = fcx.tcx.erase_regions(cause.ty);
221+
let ty = fcx.normalize_associated_types_in(cause.span, cause.ty);
222+
let erased = fcx.tcx.erase_regions(ty);
222223
if captured_tys.insert(erased) {
223224
// Replace all regions inside the generator interior with late bound regions.
224225
// Note that each region slot in the types gets a new fresh late bound region,
@@ -263,7 +264,7 @@ pub fn resolve_interior<'a, 'tcx>(
263264
// Unify the type variable inside the generator with the new witness
264265
match fcx.at(&fcx.misc(body.value.span), fcx.param_env).eq(interior, witness) {
265266
Ok(ok) => fcx.register_infer_ok_obligations(ok),
266-
_ => bug!(),
267+
_ => bug!("failed to relate {interior} and {witness}"),
267268
}
268269
}
269270

0 commit comments

Comments
 (0)