diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-06-17 00:13:00 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-07-27 21:06:35 +0200 |
| commit | cd30894c2f7113bf79c7f66d30a774f11b315d3f (patch) | |
| tree | 915e44581bef84cf34ad60f8342a8df8b37906f2 | |
| parent | 1b33f39126c56192e7e35bc943bee9cca6960abd (diff) | |
| download | rust-cd30894c2f7113bf79c7f66d30a774f11b315d3f.tar.gz rust-cd30894c2f7113bf79c7f66d30a774f11b315d3f.zip | |
anonymize_predicate
| -rw-r--r-- | src/librustc_infer/traits/util.rs | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/librustc_infer/traits/util.rs b/src/librustc_infer/traits/util.rs index 4ae7e417a8f..957c993c4bf 100644 --- a/src/librustc_infer/traits/util.rs +++ b/src/librustc_infer/traits/util.rs @@ -10,41 +10,34 @@ pub fn anonymize_predicate<'tcx>( tcx: TyCtxt<'tcx>, pred: ty::Predicate<'tcx>, ) -> ty::Predicate<'tcx> { - let kind = pred.kind(); + let kind = pred.kint(tcx); let new = match kind { - &ty::PredicateKind::Trait(ref data, constness) => { - ty::PredicateKind::Trait(tcx.anonymize_late_bound_regions(data), constness) + ty::PredicateKint::ForAll(binder) => { + ty::PredicateKint::ForAll(tcx.anonymize_late_bound_regions(binder)) } + &ty::PredicateKint::Trait(data, constness) => ty::PredicateKint::Trait(data, constness), - ty::PredicateKind::RegionOutlives(data) => { - ty::PredicateKind::RegionOutlives(tcx.anonymize_late_bound_regions(data)) - } + &ty::PredicateKint::RegionOutlives(data) => ty::PredicateKint::RegionOutlives(data), - ty::PredicateKind::TypeOutlives(data) => { - ty::PredicateKind::TypeOutlives(tcx.anonymize_late_bound_regions(data)) - } + &ty::PredicateKint::TypeOutlives(data) => ty::PredicateKint::TypeOutlives(data), - ty::PredicateKind::Projection(data) => { - ty::PredicateKind::Projection(tcx.anonymize_late_bound_regions(data)) - } + &ty::PredicateKint::Projection(data) => ty::PredicateKint::Projection(data), - &ty::PredicateKind::WellFormed(data) => ty::PredicateKind::WellFormed(data), + &ty::PredicateKint::WellFormed(data) => ty::PredicateKint::WellFormed(data), - &ty::PredicateKind::ObjectSafe(data) => ty::PredicateKind::ObjectSafe(data), + &ty::PredicateKint::ObjectSafe(data) => ty::PredicateKint::ObjectSafe(data), - &ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => { - ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) + &ty::PredicateKint::ClosureKind(closure_def_id, closure_substs, kind) => { + ty::PredicateKint::ClosureKind(closure_def_id, closure_substs, kind) } - ty::PredicateKind::Subtype(data) => { - ty::PredicateKind::Subtype(tcx.anonymize_late_bound_regions(data)) - } + &ty::PredicateKint::Subtype(data) => ty::PredicateKint::Subtype(data), - &ty::PredicateKind::ConstEvaluatable(def_id, substs) => { - ty::PredicateKind::ConstEvaluatable(def_id, substs) + &ty::PredicateKint::ConstEvaluatable(def_id, substs) => { + ty::PredicateKint::ConstEvaluatable(def_id, substs) } - ty::PredicateKind::ConstEquate(c1, c2) => ty::PredicateKind::ConstEquate(c1, c2), + &ty::PredicateKint::ConstEquate(c1, c2) => ty::PredicateKint::ConstEquate(c1, c2), }; if new != *kind { new.to_predicate(tcx) } else { pred } |
