Predicate::RegionOutlives(predicate) => predicate.lower(),
Predicate::TypeOutlives(predicate) => predicate.lower(),
Predicate::Projection(predicate) => predicate.lower(),
- Predicate::WellFormed(ty) => {
- ty::Binder::dummy(DomainGoal::WellFormed(WellFormed::Ty(*ty)))
+
+ Predicate::WellFormed(..) |
+ Predicate::ObjectSafe(..) |
+ Predicate::ClosureKind(..) |
+ Predicate::Subtype(..) |
+ Predicate::ConstEvaluatable(..) => {
+ bug!("unexpected predicate {}", self)
}
- Predicate::ObjectSafe(..)
- | Predicate::ClosureKind(..)
- | Predicate::Subtype(..)
- | Predicate::ConstEvaluatable(..) => unimplemented!(),
}
}
}
&hir::WherePredicate::BoundPredicate(ref bound_pred) => {
let ty = icx.to_ty(&bound_pred.bounded_ty);
- // Keep the type around in a WF predicate, in case of no bounds.
- // That way, `where Ty:` is not a complete noop (see #53696).
+ // Keep the type around in a dummy predicate, in case of no bounds.
+ // That way, `where Ty:` is not a complete noop (see #53696) and `Ty`
+ // is still checked for WF.
if bound_pred.bounds.is_empty() {
if let ty::Param(_) = ty.sty {
// This is a `where T:`, which can be in the HIR from the
// compiler/tooling bugs from not handling WF predicates.
} else {
let span = bound_pred.bounded_ty.span;
- predicates.push((ty::Predicate::WellFormed(ty), span));
+ let predicate = ty::OutlivesPredicate(ty, tcx.mk_region(ty::ReEmpty));
+ predicates.push(
+ (ty::Predicate::TypeOutlives(ty::Binder::dummy(predicate)), span)
+ );
}
}
Predicate::RegionOutlives(ref pred) => pred.clean(cx),
Predicate::TypeOutlives(ref pred) => pred.clean(cx),
Predicate::Projection(ref pred) => pred.clean(cx),
- Predicate::WellFormed(ty) => {
- // This comes from `where Ty:` (i.e. no bounds) (see #53696).
- WherePredicate::BoundPredicate {
- ty: ty.clean(cx),
- bounds: vec![],
- }
- }
- Predicate::ObjectSafe(_) => panic!("not user writable"),
- Predicate::ClosureKind(..) => panic!("not user writable"),
+
+ Predicate::WellFormed(..) |
+ Predicate::ObjectSafe(..) |
+ Predicate::ClosureKind(..) |
Predicate::ConstEvaluatable(..) => panic!("not user writable"),
}
}
= note: forall<'a, 'b, Self, T, U> { Implemented(Self: Foo<'a, 'b, T, U>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
= note: forall<'a, 'b, Self, T, U> { RegionOutlives('a: 'b) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
= note: forall<'a, 'b, Self, T, U> { TypeOutlives(U: 'b) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
- = note: forall<'a, 'b, Self, T, U> { WellFormed(Self: Foo<'a, 'b, T, U>) :- Implemented(Self: Foo<'a, 'b, T, U>), WellFormed(T: std::borrow::Borrow<U>), TypeOutlives(U: 'b), RegionOutlives('a: 'b), WellFormed(std::boxed::Box<T>). }
- = note: forall<'a, 'b, Self, T, U> { WellFormed(std::boxed::Box<T>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
+ = note: forall<'a, 'b, Self, T, U> { TypeOutlives(std::boxed::Box<T>: '<empty>) :- FromEnv(Self: Foo<'a, 'b, T, U>). }
+ = note: forall<'a, 'b, Self, T, U> { WellFormed(Self: Foo<'a, 'b, T, U>) :- Implemented(Self: Foo<'a, 'b, T, U>), WellFormed(T: std::borrow::Borrow<U>), TypeOutlives(U: 'b), RegionOutlives('a: 'b), TypeOutlives(std::boxed::Box<T>: '<empty>). }
error: aborting due to previous error