impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
use rustc_middle::ty::fold::TypeFoldable;
- use rustc_middle::ty::PredicateKind::*;
+ use rustc_middle::ty::PredicateAtom::*;
if cx.tcx.features().trivial_bounds {
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
let predicates = cx.tcx.predicates_of(def_id);
for &(predicate, span) in predicates.predicates {
- let predicate_kind_name = match predicate.kind() {
+ // We don't actually look inside of the predicate,
+ // so it is safe to skip this binder here.
+ let predicate_kind_name = match predicate.skip_binders() {
Trait(..) => "Trait",
TypeOutlives(..) |
RegionOutlives(..) => "Lifetime",
) -> Vec<ty::Region<'tcx>> {
inferred_outlives
.iter()
- .filter_map(|(pred, _)| match pred.kind() {
- ty::PredicateKind::RegionOutlives(outlives) => {
- let outlives = outlives.skip_binder();
- match outlives.0 {
- ty::ReEarlyBound(ebr) if ebr.index == index => Some(outlives.1),
- _ => None,
- }
- }
+ .filter_map(|(pred, _)| match pred.skip_binders() {
+ ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(a, b)) => match a {
+ ty::ReEarlyBound(ebr) if ebr.index == index => Some(b),
+ _ => None,
+ },
_ => None,
})
.collect()
) -> Vec<ty::Region<'tcx>> {
inferred_outlives
.iter()
- .filter_map(|(pred, _)| match pred.kind() {
- ty::PredicateKind::TypeOutlives(outlives) => {
- let outlives = outlives.skip_binder();
- outlives.0.is_param(index).then_some(outlives.1)
+ .filter_map(|(pred, _)| match pred.skip_binders() {
+ ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(a, b)) => {
+ a.is_param(index).then_some(b)
}
_ => None,
})