Skip to content

Commit cd30894

Browse files
committed
anonymize_predicate
1 parent 1b33f39 commit cd30894

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

src/librustc_infer/traits/util.rs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,34 @@ pub fn anonymize_predicate<'tcx>(
1010
tcx: TyCtxt<'tcx>,
1111
pred: ty::Predicate<'tcx>,
1212
) -> ty::Predicate<'tcx> {
13-
let kind = pred.kind();
13+
let kind = pred.kint(tcx);
1414
let new = match kind {
15-
&ty::PredicateKind::Trait(ref data, constness) => {
16-
ty::PredicateKind::Trait(tcx.anonymize_late_bound_regions(data), constness)
15+
ty::PredicateKint::ForAll(binder) => {
16+
ty::PredicateKint::ForAll(tcx.anonymize_late_bound_regions(binder))
1717
}
18+
&ty::PredicateKint::Trait(data, constness) => ty::PredicateKint::Trait(data, constness),
1819

19-
ty::PredicateKind::RegionOutlives(data) => {
20-
ty::PredicateKind::RegionOutlives(tcx.anonymize_late_bound_regions(data))
21-
}
20+
&ty::PredicateKint::RegionOutlives(data) => ty::PredicateKint::RegionOutlives(data),
2221

23-
ty::PredicateKind::TypeOutlives(data) => {
24-
ty::PredicateKind::TypeOutlives(tcx.anonymize_late_bound_regions(data))
25-
}
22+
&ty::PredicateKint::TypeOutlives(data) => ty::PredicateKint::TypeOutlives(data),
2623

27-
ty::PredicateKind::Projection(data) => {
28-
ty::PredicateKind::Projection(tcx.anonymize_late_bound_regions(data))
29-
}
24+
&ty::PredicateKint::Projection(data) => ty::PredicateKint::Projection(data),
3025

31-
&ty::PredicateKind::WellFormed(data) => ty::PredicateKind::WellFormed(data),
26+
&ty::PredicateKint::WellFormed(data) => ty::PredicateKint::WellFormed(data),
3227

33-
&ty::PredicateKind::ObjectSafe(data) => ty::PredicateKind::ObjectSafe(data),
28+
&ty::PredicateKint::ObjectSafe(data) => ty::PredicateKint::ObjectSafe(data),
3429

35-
&ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => {
36-
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind)
30+
&ty::PredicateKint::ClosureKind(closure_def_id, closure_substs, kind) => {
31+
ty::PredicateKint::ClosureKind(closure_def_id, closure_substs, kind)
3732
}
3833

39-
ty::PredicateKind::Subtype(data) => {
40-
ty::PredicateKind::Subtype(tcx.anonymize_late_bound_regions(data))
41-
}
34+
&ty::PredicateKint::Subtype(data) => ty::PredicateKint::Subtype(data),
4235

43-
&ty::PredicateKind::ConstEvaluatable(def_id, substs) => {
44-
ty::PredicateKind::ConstEvaluatable(def_id, substs)
36+
&ty::PredicateKint::ConstEvaluatable(def_id, substs) => {
37+
ty::PredicateKint::ConstEvaluatable(def_id, substs)
4538
}
4639

47-
ty::PredicateKind::ConstEquate(c1, c2) => ty::PredicateKind::ConstEquate(c1, c2),
40+
&ty::PredicateKint::ConstEquate(c1, c2) => ty::PredicateKint::ConstEquate(c1, c2),
4841
};
4942

5043
if new != *kind { new.to_predicate(tcx) } else { pred }

0 commit comments

Comments
 (0)