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`
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user