ty::Binder::dummy(ty::PredicateKind::WellFormed(ct.into())),
));
}
- // FIXME(generic_const_exprs): This seems wrong but I could not find a way to get this to trigger
ty::ConstKind::Expr(_) => {
- bug!("checking wfness of `ConstKind::Expr` is unsupported")
+ // FIXME(generic_const_exprs): this doesnt verify that given `Expr(N + 1)` the
+ // trait bound `typeof(N): Add<typeof(1)>` holds. This is currently unnecessary
+ // as `ConstKind::Expr` is only produced via normalization of `ConstKind::Unevaluated`
+ // which means that the `DefId` would have been typeck'd elsewhere. However in
+ // the future we may allow directly lowering to `ConstKind::Expr` in which case
+ // we would not be proving bounds we should.
+
+ let predicate =
+ ty::Binder::dummy(ty::PredicateKind::ConstEvaluatable(ct));
+ let cause = self.cause(traits::WellFormed(None));
+ self.out.push(traits::Obligation::with_depth(
+ self.tcx(),
+ cause,
+ self.recursion_depth,
+ self.param_env,
+ predicate,
+ ));
}
ty::ConstKind::Error(_)
// types appearing in the fn signature
}
- ty::Opaque(did, substs) => {
+ ty::Opaque(ty::OpaqueTy { def_id, substs }) => {
// All of the requirements on type parameters
// have already been checked for `impl Trait` in
// return position. We do need to check type-alias-impl-trait though.
- if ty::is_impl_trait_defn(self.tcx, did).is_none() {
- let obligations = self.nominal_obligations(did, substs);
+ if ty::is_impl_trait_defn(self.tcx, def_id).is_none() {
+ let obligations = self.nominal_obligations(def_id, substs);
self.out.extend(obligations);
}
}