about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-29 20:09:45 +0000
committerMichael Goulet <michael@errs.io>2022-09-22 02:17:39 +0000
commit3fc328dfd3c7699a9be3c889de55c354d5a5c006 (patch)
tree97372efa64cc0c24b3c63579af45a80a380e6d1c
parent02ad984d74b6e238b16a50c61505d76acc0e648c (diff)
downloadrust-3fc328dfd3c7699a9be3c889de55c354d5a5c006.tar.gz
rust-3fc328dfd3c7699a9be3c889de55c354d5a5c006.zip
Normalize generator interior type before erasing
-rw-r--r--compiler/rustc_typeck/src/check/generator_interior.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/generator_interior.rs b/compiler/rustc_typeck/src/check/generator_interior.rs
index 7ab6d9e2bab..254a19368bf 100644
--- a/compiler/rustc_typeck/src/check/generator_interior.rs
+++ b/compiler/rustc_typeck/src/check/generator_interior.rs
@@ -218,7 +218,8 @@ pub fn resolve_interior<'a, 'tcx>(
         .filter_map(|mut cause| {
             // Erase regions and canonicalize late-bound regions to deduplicate as many types as we
             // can.
-            let erased = fcx.tcx.erase_regions(cause.ty);
+            let ty = fcx.normalize_associated_types_in(cause.span, cause.ty);
+            let erased = fcx.tcx.erase_regions(ty);
             if captured_tys.insert(erased) {
                 // Replace all regions inside the generator interior with late bound regions.
                 // 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>(
     // Unify the type variable inside the generator with the new witness
     match fcx.at(&fcx.misc(body.value.span), fcx.param_env).eq(interior, witness) {
         Ok(ok) => fcx.register_infer_ok_obligations(ok),
-        _ => bug!(),
+        _ => bug!("failed to relate {interior} and {witness}"),
     }
 }