]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_trait_selection/src/traits/wf.rs
Do not require const predicates to hold when checking if a projection type is wf
[rust.git] / compiler / rustc_trait_selection / src / traits / wf.rs
index 9a571837e9f5a04521b7aeaa9553af7d18e41003..a86234291ca5700f58ae62c2df17e80641cdf899 100644 (file)
@@ -101,6 +101,7 @@ pub fn trait_obligations<'a, 'tcx>(
     wf.normalize(infcx)
 }
 
+#[instrument(skip(infcx), ret)]
 pub fn predicate_obligations<'a, 'tcx>(
     infcx: &InferCtxt<'a, 'tcx>,
     param_env: ty::ParamEnv<'tcx>,
@@ -391,7 +392,8 @@ fn compute_projection(&mut self, data: ty::ProjectionTy<'tcx>) {
         //     `i32: Clone`
         //     `i32: Copy`
         // ]
-        let obligations = self.nominal_obligations(data.item_def_id, data.substs);
+        // Projection types do not require const predicates.
+        let obligations = self.nominal_obligations_without_const(data.item_def_id, data.substs);
         self.out.extend(obligations);
 
         let tcx = self.tcx();
@@ -440,6 +442,7 @@ fn compute(&mut self, arg: GenericArg<'tcx>) {
         let param_env = self.param_env;
         let depth = self.recursion_depth;
         while let Some(arg) = walker.next() {
+            debug!(?arg, ?self.out);
             let ty = match arg.unpack() {
                 GenericArgKind::Type(ty) => ty,
 
@@ -637,7 +640,7 @@ fn compute(&mut self, arg: GenericArg<'tcx>) {
                     }
                 }
 
-                ty::Dynamic(data, r) => {
+                ty::Dynamic(data, r, _) => {
                     // WfObject
                     //
                     // Here, we defer WF checking due to higher-ranked
@@ -689,6 +692,8 @@ fn compute(&mut self, arg: GenericArg<'tcx>) {
                     ));
                 }
             }
+
+            debug!(?self.out);
         }
     }