about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/outlives/mod.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-20 03:25:40 +0000
committerMichael Goulet <michael@errs.io>2023-06-22 18:34:24 +0000
commit471830b3a488b203e3bfde2e58eecad826287c2d (patch)
tree6c8030dd00f679d0e6f8e0922e79fe23232e470b /compiler/rustc_hir_analysis/src/outlives/mod.rs
parent2fa796a3c796c819b53421577d5fd2e0f6a9f920 (diff)
downloadrust-471830b3a488b203e3bfde2e58eecad826287c2d.tar.gz
rust-471830b3a488b203e3bfde2e58eecad826287c2d.zip
migrate inferred_outlives_of to Clause
Diffstat (limited to 'compiler/rustc_hir_analysis/src/outlives/mod.rs')
-rw-r--r--compiler/rustc_hir_analysis/src/outlives/mod.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_hir_analysis/src/outlives/mod.rs b/compiler/rustc_hir_analysis/src/outlives/mod.rs
index 98f4a8e00ef..48624cefe4d 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::LocalDefId;
 use rustc_middle::query::Providers;
 use rustc_middle::ty::subst::GenericArgKind;
-use rustc_middle::ty::{self, CratePredicatesMap, TyCtxt};
+use rustc_middle::ty::{self, CratePredicatesMap, ToPredicate, 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: LocalDefId) -> &[(ty::ClauseKind<'_>, Span)] {
+fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clause<'_>, Span)] {
     let id = tcx.hir().local_def_id_to_hir_id(item_def_id);
 
     if matches!(tcx.def_kind(item_def_id), hir::def::DefKind::AnonConst)
@@ -52,7 +52,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clau
                 if tcx.has_attr(item_def_id, sym::rustc_outlives) {
                     let mut pred: Vec<String> = predicates
                         .iter()
-                        .map(|(out_pred, _)| match out_pred {
+                        .map(|(out_pred, _)| match out_pred.kind().skip_binder() {
                             ty::ClauseKind::RegionOutlives(p) => p.to_string(),
                             ty::ClauseKind::TypeOutlives(p) => p.to_string(),
                             err => bug!("unexpected clause {:?}", err),
@@ -104,13 +104,15 @@ fn inferred_outlives_crate(tcx: TyCtxt<'_>, (): ()) -> CratePredicatesMap<'_> {
                     |(ty::OutlivesPredicate(kind1, region2), &span)| {
                         match kind1.unpack() {
                             GenericArgKind::Type(ty1) => Some((
-                                ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(ty1, *region2)),
+                                ty::ClauseKind::TypeOutlives(ty::OutlivesPredicate(ty1, *region2))
+                                    .to_predicate(tcx),
                                 span,
                             )),
                             GenericArgKind::Lifetime(region1) => Some((
                                 ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(
                                     region1, *region2,
-                                )),
+                                ))
+                                .to_predicate(tcx),
                                 span,
                             )),
                             GenericArgKind::Const(_) => {