about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/infer/projection.rs
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2023-07-04 10:06:39 +0200
committerlcnr <rust@lcnr.de>2023-07-04 10:06:39 +0200
commitb468bfb36183bd1e688c16687139bcfa886efff6 (patch)
treea42e0a4b12f9cb6180e0742800ae5e7481b330e5 /compiler/rustc_infer/src/infer/projection.rs
parent0130c3a06e50ebb166655f81997ce28b9e4029b0 (diff)
downloadrust-b468bfb36183bd1e688c16687139bcfa886efff6.tar.gz
rust-b468bfb36183bd1e688c16687139bcfa886efff6.zip
-Ztrait-solver=next: stop depending on old solver
Diffstat (limited to 'compiler/rustc_infer/src/infer/projection.rs')
-rw-r--r--compiler/rustc_infer/src/infer/projection.rs37
1 files changed, 13 insertions, 24 deletions
diff --git a/compiler/rustc_infer/src/infer/projection.rs b/compiler/rustc_infer/src/infer/projection.rs
index 75455533181..38e74e53868 100644
--- a/compiler/rustc_infer/src/infer/projection.rs
+++ b/compiler/rustc_infer/src/infer/projection.rs
@@ -21,29 +21,18 @@ impl<'tcx> InferCtxt<'tcx> {
         recursion_depth: usize,
         obligations: &mut Vec<PredicateObligation<'tcx>>,
     ) -> Ty<'tcx> {
-        if self.next_trait_solver() {
-            // FIXME(-Ztrait-solver=next): Instead of branching here,
-            // completely change the normalization routine with the new solver.
-            //
-            // The new solver correctly handles projection equality so this hack
-            // is not necessary. if re-enabled it should emit `PredicateKind::AliasRelate`
-            // not `PredicateKind::Clause(ClauseKind::Projection(..))` as in the new solver
-            // `Projection` is used as `normalizes-to` which will fail for `<T as Trait>::Assoc eq ?0`.
-            return projection_ty.to_ty(self.tcx);
-        } else {
-            let def_id = projection_ty.def_id;
-            let ty_var = self.next_ty_var(TypeVariableOrigin {
-                kind: TypeVariableOriginKind::NormalizeProjectionType,
-                span: self.tcx.def_span(def_id),
-            });
-            let projection =
-                ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::Projection(
-                    ty::ProjectionPredicate { projection_ty, term: ty_var.into() },
-                )));
-            let obligation =
-                Obligation::with_depth(self.tcx, cause, recursion_depth, param_env, projection);
-            obligations.push(obligation);
-            ty_var
-        }
+        debug_assert!(!self.next_trait_solver());
+        let def_id = projection_ty.def_id;
+        let ty_var = self.next_ty_var(TypeVariableOrigin {
+            kind: TypeVariableOriginKind::NormalizeProjectionType,
+            span: self.tcx.def_span(def_id),
+        });
+        let projection = ty::Binder::dummy(ty::PredicateKind::Clause(ty::ClauseKind::Projection(
+            ty::ProjectionPredicate { projection_ty, term: ty_var.into() },
+        )));
+        let obligation =
+            Obligation::with_depth(self.tcx, cause, recursion_depth, param_env, projection);
+        obligations.push(obligation);
+        ty_var
     }
 }