// It's ok to skip the binder here because wf code is prepared for it
match predicate.kind().skip_binder() {
- ty::PredicateKind::Trait(t) => {
+ ty::PredicateKind::Clause(ty::Clause::Trait(t)) => {
wf.compute_trait_pred(&t, Elaborate::None);
}
- ty::PredicateKind::RegionOutlives(..) => {}
- ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ty, _reg)) => {
+ ty::PredicateKind::Clause(ty::Clause::RegionOutlives(..)) => {}
+ ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(ty, _reg))) => {
wf.compute(ty.into());
}
- ty::PredicateKind::Projection(t) => {
+ ty::PredicateKind::Clause(ty::Clause::Projection(t)) => {
wf.compute_projection(t.projection_ty);
wf.compute(match t.term.unpack() {
ty::TermKind::Ty(ty) => ty.into(),
wf.compute(c1.into());
wf.compute(c2.into());
}
+ ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::TypeWellFormedFromEnv(..) => {
bug!("TypeWellFormedFromEnv is only used for Chalk")
}
// It is fine to skip the binder as we don't care about regions here.
match pred.kind().skip_binder() {
- ty::PredicateKind::Projection(proj) => {
+ ty::PredicateKind::Clause(ty::Clause::Projection(proj)) => {
// The obligation comes not from the current `impl` nor the `trait` being implemented,
// but rather from a "second order" obligation, where an associated type has a
// projection coming from another associated type. See
cause.span = impl_item_span;
}
}
- ty::PredicateKind::Trait(pred) => {
+ ty::PredicateKind::Clause(ty::Clause::Trait(pred)) => {
// An associated item obligation born out of the `trait` failed to be met. An example
// can be seen in `ui/associated-types/point-at-type-on-obligation-failure-2.rs`.
debug!("extended_cause_with_original_assoc_item_obligation trait proj {:?}", pred);
fn require_sized(&mut self, subty: Ty<'tcx>, cause: traits::ObligationCauseCode<'tcx>) {
if !subty.has_escaping_bound_vars() {
let cause = self.cause(cause);
- let trait_ref = ty::TraitRef {
- def_id: self.tcx.require_lang_item(LangItem::Sized, None),
- substs: self.tcx.mk_substs_trait(subty, &[]),
- };
+ let trait_ref = self.tcx.at(cause.span).mk_trait_ref(LangItem::Sized, [subty]);
self.out.push(traits::Obligation::with_depth(
self.tcx,
cause,
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")
+ }
+
ty::ConstKind::Error(_)
| ty::ConstKind::Param(_)
| ty::ConstKind::Bound(..)
cause,
depth,
param_env,
- ty::Binder::dummy(ty::PredicateKind::TypeOutlives(
+ ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::TypeOutlives(
ty::OutlivesPredicate(rty, r),
- )),
+ ))),
));
}
}
.filter_map(|obligation| {
debug!(?obligation);
match obligation.predicate.kind().skip_binder() {
- ty::PredicateKind::Projection(..)
- | ty::PredicateKind::Trait(..)
+ ty::PredicateKind::Clause(ty::Clause::Projection(..))
+ | ty::PredicateKind::Clause(ty::Clause::Trait(..))
| ty::PredicateKind::Subtype(..)
| ty::PredicateKind::Coerce(..)
| ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
- | ty::PredicateKind::RegionOutlives(..)
+ | ty::PredicateKind::Clause(ty::Clause::RegionOutlives(..))
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::ConstEquate(..)
+ | ty::PredicateKind::Ambiguous
| ty::PredicateKind::TypeWellFormedFromEnv(..) => None,
- ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(ref t, ref r)) => {
+ ty::PredicateKind::Clause(ty::Clause::TypeOutlives(ty::OutlivesPredicate(
+ ref t,
+ ref r,
+ ))) => {
// Search for a bound of the form `erased_self_ty
// : 'a`, but be wary of something like `for<'a>
// erased_self_ty : 'a` (we interpret a