about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/outlives/mod.rs
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-11-25 16:35:27 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-11-29 12:01:58 -0300
commit537488efd6f0be7240b5e2d08cae4af5db7162ab (patch)
treeccd01f180e00fa75b4629ca81b1244b532a7f1fe /compiler/rustc_hir_analysis/src/outlives/mod.rs
parentc372b1470109547e37dcc29ffd4723ac9f66f15d (diff)
downloadrust-537488efd6f0be7240b5e2d08cae4af5db7162ab.tar.gz
rust-537488efd6f0be7240b5e2d08cae4af5db7162ab.zip
Make inferred_outlives_crate return Clause
Diffstat (limited to 'compiler/rustc_hir_analysis/src/outlives/mod.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/outlives/mod.rs26
1 files changed, 8 insertions, 18 deletions
diff --git a/compiler/rustc_hir_analysis/src/outlives/mod.rs b/compiler/rustc_hir_analysis/src/outlives/mod.rs
index c8f37176836..81fe32000d3 100644
--- a/compiler/rustc_hir_analysis/src/outlives/mod.rs
+++ b/compiler/rustc_hir_analysis/src/outlives/mod.rs
@@ -3,7 +3,7 @@ use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
 use rustc_middle::ty::query::Providers;
 use rustc_middle::ty::subst::GenericArgKind;
-use rustc_middle::ty::{self, CratePredicatesMap, ToPredicate, TyCtxt};
+use rustc_middle::ty::{self, CratePredicatesMap, TyCtxt};
 use rustc_span::symbol::sym;
 use rustc_span::Span;
 
@@ -17,7 +17,7 @@ pub fn provide(providers: &mut Providers) {
     *providers = Providers { inferred_outlives_of, inferred_outlives_crate, ..*providers };
 }
 
-fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate<'_>, Span)] {
+fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Clause<'_>, Span)] {
     let id = tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local());
 
     if matches!(tcx.def_kind(item_def_id), hir::def::DefKind::AnonConst) && tcx.lazy_normalization()
@@ -50,12 +50,10 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[(ty::Predicate
                 if tcx.has_attr(item_def_id, sym::rustc_outlives) {
                     let mut pred: Vec<String> = predicates
                         .iter()
-                        .map(|(out_pred, _)| match out_pred.kind().skip_binder() {
-                            ty::PredicateKind::Clause(ty::Clause::RegionOutlives(p)) => {
-                                p.to_string()
-                            }
-                            ty::PredicateKind::Clause(ty::Clause::TypeOutlives(p)) => p.to_string(),
-                            err => bug!("unexpected predicate {:?}", err),
+                        .map(|(out_pred, _)| match out_pred {
+                            ty::Clause::RegionOutlives(p) => p.to_string(),
+                            ty::Clause::TypeOutlives(p) => p.to_string(),
+                            err => bug!("unexpected clause {:?}", err),
                         })
                         .collect();
                     pred.sort();
@@ -103,19 +101,11 @@ fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CratePredicatesMap<'_> {
                 |(ty::OutlivesPredicate(kind1, region2), &span)| {
                     match kind1.unpack() {
                         GenericArgKind::Type(ty1) => Some((
-                            ty::Binder::dummy(ty::PredicateKind::Clause(ty::Clause::TypeOutlives(
-                                ty::OutlivesPredicate(ty1, *region2),
-                            )))
-                            .to_predicate(tcx),
+                            ty::Clause::TypeOutlives(ty::OutlivesPredicate(ty1, *region2)),
                             span,
                         )),
                         GenericArgKind::Lifetime(region1) => Some((
-                            ty::Binder::dummy(ty::PredicateKind::Clause(
-                                ty::Clause::RegionOutlives(ty::OutlivesPredicate(
-                                    region1, *region2,
-                                )),
-                            ))
-                            .to_predicate(tcx),
+                            ty::Clause::RegionOutlives(ty::OutlivesPredicate(region1, *region2)),
                             span,
                         )),
                         GenericArgKind::Const(_) => {