Auto merge of #80679 - jackh726:predicate-kind-take2, r=lcnr
Remove PredicateKind and instead only use Binder<PredicateAtom> Originally brought up in https://github.com/rust-lang/rust/pull/76814#discussion_r546858171 r? `@lcnr`
This commit is contained in:
commit
4253153db2
71 changed files with 652 additions and 756 deletions
|
@ -1550,13 +1550,13 @@ declare_lint_pass!(
|
|||
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::PredicateAtom::*;
|
||||
use rustc_middle::ty::PredicateKind::*;
|
||||
|
||||
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.skip_binders() {
|
||||
let predicate_kind_name = match predicate.kind().skip_binder() {
|
||||
Trait(..) => "Trait",
|
||||
TypeOutlives(..) |
|
||||
RegionOutlives(..) => "Lifetime",
|
||||
|
@ -1936,8 +1936,8 @@ impl ExplicitOutlivesRequirements {
|
|||
) -> Vec<ty::Region<'tcx>> {
|
||||
inferred_outlives
|
||||
.iter()
|
||||
.filter_map(|(pred, _)| match pred.skip_binders() {
|
||||
ty::PredicateAtom::RegionOutlives(ty::OutlivesPredicate(a, b)) => match a {
|
||||
.filter_map(|(pred, _)| match pred.kind().skip_binder() {
|
||||
ty::PredicateKind::RegionOutlives(ty::OutlivesPredicate(a, b)) => match a {
|
||||
ty::ReEarlyBound(ebr) if ebr.index == index => Some(b),
|
||||
_ => None,
|
||||
},
|
||||
|
@ -1952,8 +1952,8 @@ impl ExplicitOutlivesRequirements {
|
|||
) -> Vec<ty::Region<'tcx>> {
|
||||
inferred_outlives
|
||||
.iter()
|
||||
.filter_map(|(pred, _)| match pred.skip_binders() {
|
||||
ty::PredicateAtom::TypeOutlives(ty::OutlivesPredicate(a, b)) => {
|
||||
.filter_map(|(pred, _)| match pred.kind().skip_binder() {
|
||||
ty::PredicateKind::TypeOutlives(ty::OutlivesPredicate(a, b)) => {
|
||||
a.is_param(index).then_some(b)
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
@ -45,12 +45,12 @@ declare_lint_pass!(
|
|||
|
||||
impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
|
||||
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
|
||||
use rustc_middle::ty::PredicateAtom::*;
|
||||
use rustc_middle::ty::PredicateKind::*;
|
||||
|
||||
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
|
||||
let predicates = cx.tcx.explicit_predicates_of(def_id);
|
||||
for &(predicate, span) in predicates.predicates {
|
||||
let trait_predicate = match predicate.skip_binders() {
|
||||
let trait_predicate = match predicate.kind().skip_binder() {
|
||||
Trait(trait_predicate, _constness) => trait_predicate,
|
||||
_ => continue,
|
||||
};
|
||||
|
|
|
@ -202,8 +202,8 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
|
|||
let mut has_emitted = false;
|
||||
for &(predicate, _) in cx.tcx.explicit_item_bounds(def) {
|
||||
// We only look at the `DefId`, so it is safe to skip the binder here.
|
||||
if let ty::PredicateAtom::Trait(ref poly_trait_predicate, _) =
|
||||
predicate.skip_binders()
|
||||
if let ty::PredicateKind::Trait(ref poly_trait_predicate, _) =
|
||||
predicate.kind().skip_binder()
|
||||
{
|
||||
let def_id = poly_trait_predicate.trait_ref.def_id;
|
||||
let descr_pre =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue