diff options
| author | bors <bors@rust-lang.org> | 2021-09-21 10:33:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-21 10:33:15 +0000 |
| commit | dda2a0eca4a70acbdd2b65f5fc5e4cd38c39351b (patch) | |
| tree | d27b21c4eda7a9a8b3e6a144493d95cedcc3d833 /compiler/rustc_trait_selection/src/traits | |
| parent | 49c0861ed0fa1d95186d88df0cd4310103e70957 (diff) | |
| parent | afb7472bcca54bffcab6841345cbf58e9f5dfa33 (diff) | |
| download | rust-dda2a0eca4a70acbdd2b65f5fc5e4cd38c39351b.tar.gz rust-dda2a0eca4a70acbdd2b65f5fc5e4cd38c39351b.zip | |
Auto merge of #89045 - oli-obk:lazy_normalization_in_opaque_types, r=nikomatsakis
Register normalization obligations instead of immediately normalizing in opaque type instantiation For lazy TAIT we will need to instantiate opaque types from within `rustc_infer`, which cannot invoke normalization methods (they are in `rustc_trait_resolution`). So before we move the logic over to `rustc_infer`, we need make sure no normalization happens anymore. This PR resolves that by just registering normalization obligations and continuing. This PR is best reviewed commit by commit I also included f7ad36e which is just an independent cleanup that touches the same code and reduces diagnostics noise a bit r? `@nikomatsakis` cc `@spastorino`
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/project.rs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 4f22543950c..873c058c55c 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -810,17 +810,7 @@ pub fn normalize_projection_type<'a, 'b, 'tcx>( // and a deferred predicate to resolve this when more type // information is available. - let tcx = selcx.infcx().tcx; - let def_id = projection_ty.item_def_id; - let ty_var = selcx.infcx().next_ty_var(TypeVariableOrigin { - kind: TypeVariableOriginKind::NormalizeProjectionType, - span: tcx.def_span(def_id), - }); - let projection = ty::Binder::dummy(ty::ProjectionPredicate { projection_ty, ty: ty_var }); - let obligation = - Obligation::with_depth(cause, depth + 1, param_env, projection.to_predicate(tcx)); - obligations.push(obligation); - ty_var + selcx.infcx().infer_projection(param_env, projection_ty, cause, depth + 1, obligations) }) } |
