diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-10 11:03:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-10 11:03:07 +0100 |
| commit | ca9fc28f0be061ef770bec410d90c5418b6689dd (patch) | |
| tree | 5ae7da92a0fa647143e1c7283e19840591d90ffa /compiler/rustc_mir_transform/src | |
| parent | a4ac4fae416b18f71a2f7ef2772ca4a4cc871828 (diff) | |
| parent | d35b23ecd8f8fd1aa33ebd106bb5f13414a66cf4 (diff) | |
| download | rust-ca9fc28f0be061ef770bec410d90c5418b6689dd.tar.gz rust-ca9fc28f0be061ef770bec410d90c5418b6689dd.zip | |
Rollup merge of #92636 - compiler-errors:normalize-generator-const-expr, r=oli-obk
Normalize generator-local types with unevaluated constants Normalize generator-interior types in addition to (i.e. instead of just) erasing regions, since sometimes we collect types with unevaluated const exprs. Fixes #84737 Fixes #88171 Fixes #92091 Fixes #92634 Probably also fixes #73114, but that one has no code I could test. It looks like it's the same issue, though.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/generator.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index bc9a104e849..08247e6f22a 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -726,9 +726,13 @@ fn sanitize_witness<'tcx>( saved_locals: &GeneratorSavedLocals, ) { let did = body.source.def_id(); - let allowed_upvars = tcx.erase_regions(upvars); + let param_env = tcx.param_env(did); + + let allowed_upvars = tcx.normalize_erasing_regions(param_env, upvars); let allowed = match witness.kind() { - &ty::GeneratorWitness(s) => tcx.erase_late_bound_regions(s), + &ty::GeneratorWitness(interior_tys) => { + tcx.normalize_erasing_late_bound_regions(param_env, interior_tys) + } _ => { tcx.sess.delay_span_bug( body.span, @@ -738,8 +742,6 @@ fn sanitize_witness<'tcx>( } }; - let param_env = tcx.param_env(did); - for (local, decl) in body.local_decls.iter_enumerated() { // Ignore locals which are internal or not saved between yields. if !saved_locals.contains(local) || decl.internal { |
