Skip to content

Commit cad8fe9

Browse files
committed
rename Predicate to PredicateKind, introduce alias
1 parent f182c4a commit cad8fe9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+406
-383
lines changed

src/librustc_infer/infer/canonical/query_response.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,12 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
532532
cause.clone(),
533533
param_env,
534534
match k1.unpack() {
535-
GenericArgKind::Lifetime(r1) => ty::Predicate::RegionOutlives(
535+
GenericArgKind::Lifetime(r1) => ty::PredicateKind::RegionOutlives(
536536
ty::Binder::bind(ty::OutlivesPredicate(r1, r2)),
537537
),
538-
GenericArgKind::Type(t1) => {
539-
ty::Predicate::TypeOutlives(ty::Binder::bind(ty::OutlivesPredicate(t1, r2)))
540-
}
538+
GenericArgKind::Type(t1) => ty::PredicateKind::TypeOutlives(ty::Binder::bind(
539+
ty::OutlivesPredicate(t1, r2),
540+
)),
541541
GenericArgKind::Const(..) => {
542542
// Consts cannot outlive one another, so we don't expect to
543543
// ecounter this branch.
@@ -664,7 +664,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
664664
self.obligations.push(Obligation {
665665
cause: self.cause.clone(),
666666
param_env: self.param_env,
667-
predicate: ty::Predicate::RegionOutlives(ty::Binder::dummy(ty::OutlivesPredicate(
667+
predicate: ty::PredicateKind::RegionOutlives(ty::Binder::dummy(ty::OutlivesPredicate(
668668
sup, sub,
669669
))),
670670
recursion_depth: 0,

src/librustc_infer/infer/combine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
307307
self.obligations.push(Obligation::new(
308308
self.trace.cause.clone(),
309309
self.param_env,
310-
ty::Predicate::WellFormed(b_ty),
310+
ty::PredicateKind::WellFormed(b_ty),
311311
));
312312
}
313313

src/librustc_infer/infer/outlives/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ pub fn explicit_outlives_bounds<'tcx>(
1212
) -> impl Iterator<Item = OutlivesBound<'tcx>> + 'tcx {
1313
debug!("explicit_outlives_bounds()");
1414
param_env.caller_bounds.into_iter().filter_map(move |predicate| match predicate {
15-
ty::Predicate::Projection(..)
16-
| ty::Predicate::Trait(..)
17-
| ty::Predicate::Subtype(..)
18-
| ty::Predicate::WellFormed(..)
19-
| ty::Predicate::ObjectSafe(..)
20-
| ty::Predicate::ClosureKind(..)
21-
| ty::Predicate::TypeOutlives(..)
22-
| ty::Predicate::ConstEvaluatable(..)
23-
| ty::Predicate::ConstEquate(..) => None,
24-
ty::Predicate::RegionOutlives(ref data) => data
15+
ty::PredicateKind::Projection(..)
16+
| ty::PredicateKind::Trait(..)
17+
| ty::PredicateKind::Subtype(..)
18+
| ty::PredicateKind::WellFormed(..)
19+
| ty::PredicateKind::ObjectSafe(..)
20+
| ty::PredicateKind::ClosureKind(..)
21+
| ty::PredicateKind::TypeOutlives(..)
22+
| ty::PredicateKind::ConstEvaluatable(..)
23+
| ty::PredicateKind::ConstEquate(..) => None,
24+
ty::PredicateKind::RegionOutlives(ref data) => data
2525
.no_bound_vars()
2626
.map(|ty::OutlivesPredicate(r_a, r_b)| OutlivesBound::RegionSubRegion(r_b, r_a)),
2727
})

src/librustc_infer/infer/sub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
100100
self.fields.obligations.push(Obligation::new(
101101
self.fields.trace.cause.clone(),
102102
self.fields.param_env,
103-
ty::Predicate::Subtype(ty::Binder::dummy(ty::SubtypePredicate {
103+
ty::PredicateKind::Subtype(ty::Binder::dummy(ty::SubtypePredicate {
104104
a_is_expected: self.a_is_expected,
105105
a,
106106
b,

src/librustc_infer/traits/util.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,39 @@ pub fn anonymize_predicate<'tcx>(
1111
pred: &ty::Predicate<'tcx>,
1212
) -> ty::Predicate<'tcx> {
1313
match *pred {
14-
ty::Predicate::Trait(ref data, constness) => {
15-
ty::Predicate::Trait(tcx.anonymize_late_bound_regions(data), constness)
14+
ty::PredicateKind::Trait(ref data, constness) => {
15+
ty::PredicateKind::Trait(tcx.anonymize_late_bound_regions(data), constness)
1616
}
1717

18-
ty::Predicate::RegionOutlives(ref data) => {
19-
ty::Predicate::RegionOutlives(tcx.anonymize_late_bound_regions(data))
18+
ty::PredicateKind::RegionOutlives(ref data) => {
19+
ty::PredicateKind::RegionOutlives(tcx.anonymize_late_bound_regions(data))
2020
}
2121

22-
ty::Predicate::TypeOutlives(ref data) => {
23-
ty::Predicate::TypeOutlives(tcx.anonymize_late_bound_regions(data))
22+
ty::PredicateKind::TypeOutlives(ref data) => {
23+
ty::PredicateKind::TypeOutlives(tcx.anonymize_late_bound_regions(data))
2424
}
2525

26-
ty::Predicate::Projection(ref data) => {
27-
ty::Predicate::Projection(tcx.anonymize_late_bound_regions(data))
26+
ty::PredicateKind::Projection(ref data) => {
27+
ty::PredicateKind::Projection(tcx.anonymize_late_bound_regions(data))
2828
}
2929

30-
ty::Predicate::WellFormed(data) => ty::Predicate::WellFormed(data),
30+
ty::PredicateKind::WellFormed(data) => ty::PredicateKind::WellFormed(data),
3131

32-
ty::Predicate::ObjectSafe(data) => ty::Predicate::ObjectSafe(data),
32+
ty::PredicateKind::ObjectSafe(data) => ty::PredicateKind::ObjectSafe(data),
3333

34-
ty::Predicate::ClosureKind(closure_def_id, closure_substs, kind) => {
35-
ty::Predicate::ClosureKind(closure_def_id, closure_substs, kind)
34+
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind) => {
35+
ty::PredicateKind::ClosureKind(closure_def_id, closure_substs, kind)
3636
}
3737

38-
ty::Predicate::Subtype(ref data) => {
39-
ty::Predicate::Subtype(tcx.anonymize_late_bound_regions(data))
38+
ty::PredicateKind::Subtype(ref data) => {
39+
ty::PredicateKind::Subtype(tcx.anonymize_late_bound_regions(data))
4040
}
4141

42-
ty::Predicate::ConstEvaluatable(def_id, substs) => {
43-
ty::Predicate::ConstEvaluatable(def_id, substs)
42+
ty::PredicateKind::ConstEvaluatable(def_id, substs) => {
43+
ty::PredicateKind::ConstEvaluatable(def_id, substs)
4444
}
4545

46-
ty::Predicate::ConstEquate(c1, c2) => ty::Predicate::ConstEquate(c1, c2),
46+
ty::PredicateKind::ConstEquate(c1, c2) => ty::Predicate::ConstEquate(c1, c2),
4747
}
4848
}
4949

@@ -146,7 +146,7 @@ impl Elaborator<'tcx> {
146146
fn elaborate(&mut self, obligation: &PredicateObligation<'tcx>) {
147147
let tcx = self.visited.tcx;
148148
match obligation.predicate {
149-
ty::Predicate::Trait(ref data, _) => {
149+
ty::PredicateKind::Trait(ref data, _) => {
150150
// Get predicates declared on the trait.
151151
let predicates = tcx.super_predicates_of(data.def_id());
152152

@@ -167,36 +167,36 @@ impl Elaborator<'tcx> {
167167

168168
self.stack.extend(obligations);
169169
}
170-
ty::Predicate::WellFormed(..) => {
170+
ty::PredicateKind::WellFormed(..) => {
171171
// Currently, we do not elaborate WF predicates,
172172
// although we easily could.
173173
}
174-
ty::Predicate::ObjectSafe(..) => {
174+
ty::PredicateKind::ObjectSafe(..) => {
175175
// Currently, we do not elaborate object-safe
176176
// predicates.
177177
}
178-
ty::Predicate::Subtype(..) => {
178+
ty::PredicateKind::Subtype(..) => {
179179
// Currently, we do not "elaborate" predicates like `X <: Y`,
180180
// though conceivably we might.
181181
}
182-
ty::Predicate::Projection(..) => {
182+
ty::PredicateKind::Projection(..) => {
183183
// Nothing to elaborate in a projection predicate.
184184
}
185-
ty::Predicate::ClosureKind(..) => {
185+
ty::PredicateKind::ClosureKind(..) => {
186186
// Nothing to elaborate when waiting for a closure's kind to be inferred.
187187
}
188-
ty::Predicate::ConstEvaluatable(..) => {
188+
ty::PredicateKind::ConstEvaluatable(..) => {
189189
// Currently, we do not elaborate const-evaluatable
190190
// predicates.
191191
}
192-
ty::Predicate::ConstEquate(..) => {
192+
ty::PredicateKind::ConstEquate(..) => {
193193
// Currently, we do not elaborate const-equate
194194
// predicates.
195195
}
196-
ty::Predicate::RegionOutlives(..) => {
196+
ty::PredicateKind::RegionOutlives(..) => {
197197
// Nothing to elaborate from `'a: 'b`.
198198
}
199-
ty::Predicate::TypeOutlives(ref data) => {
199+
ty::PredicateKind::TypeOutlives(ref data) => {
200200
// We know that `T: 'a` for some type `T`. We can
201201
// often elaborate this. For example, if we know that
202202
// `[U]: 'a`, that implies that `U: 'a`. Similarly, if
@@ -228,15 +228,15 @@ impl Elaborator<'tcx> {
228228
if r.is_late_bound() {
229229
None
230230
} else {
231-
Some(ty::Predicate::RegionOutlives(ty::Binder::dummy(
231+
Some(ty::PredicateKind::RegionOutlives(ty::Binder::dummy(
232232
ty::OutlivesPredicate(r, r_min),
233233
)))
234234
}
235235
}
236236

237237
Component::Param(p) => {
238238
let ty = tcx.mk_ty_param(p.index, p.name);
239-
Some(ty::Predicate::TypeOutlives(ty::Binder::dummy(
239+
Some(ty::PredicateKind::TypeOutlives(ty::Binder::dummy(
240240
ty::OutlivesPredicate(ty, r_min),
241241
)))
242242
}
@@ -317,7 +317,7 @@ impl<'tcx, I: Iterator<Item = PredicateObligation<'tcx>>> Iterator for FilterToT
317317

318318
fn next(&mut self) -> Option<ty::PolyTraitRef<'tcx>> {
319319
while let Some(obligation) = self.base_iterator.next() {
320-
if let ty::Predicate::Trait(data, _) = obligation.predicate {
320+
if let ty::PredicateKind::Trait(data, _) = obligation.predicate {
321321
return Some(data.to_poly_trait_ref());
322322
}
323323
}

src/librustc_lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ declare_lint_pass!(
12021202
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TrivialConstraints {
12031203
fn check_item(&mut self, cx: &LateContext<'a, 'tcx>, item: &'tcx hir::Item<'tcx>) {
12041204
use rustc_middle::ty::fold::TypeFoldable;
1205-
use rustc_middle::ty::Predicate::*;
1205+
use rustc_middle::ty::PredicateKind::*;
12061206

12071207
if cx.tcx.features().trivial_bounds {
12081208
let def_id = cx.tcx.hir().local_def_id(item.hir_id);
@@ -1498,7 +1498,7 @@ impl ExplicitOutlivesRequirements {
14981498
inferred_outlives
14991499
.iter()
15001500
.filter_map(|(pred, _)| match pred {
1501-
ty::Predicate::RegionOutlives(outlives) => {
1501+
ty::PredicateKind::RegionOutlives(outlives) => {
15021502
let outlives = outlives.skip_binder();
15031503
match outlives.0 {
15041504
ty::ReEarlyBound(ebr) if ebr.index == index => Some(outlives.1),
@@ -1517,7 +1517,7 @@ impl ExplicitOutlivesRequirements {
15171517
inferred_outlives
15181518
.iter()
15191519
.filter_map(|(pred, _)| match pred {
1520-
ty::Predicate::TypeOutlives(outlives) => {
1520+
ty::PredicateKind::TypeOutlives(outlives) => {
15211521
let outlives = outlives.skip_binder();
15221522
outlives.0.is_param(index).then_some(outlives.1)
15231523
}

src/librustc_lint/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
146146
ty::Opaque(def, _) => {
147147
let mut has_emitted = false;
148148
for (predicate, _) in cx.tcx.predicates_of(def).predicates {
149-
if let ty::Predicate::Trait(ref poly_trait_predicate, _) = predicate {
149+
if let ty::PredicateKind::Trait(ref poly_trait_predicate, _) = predicate {
150150
let trait_ref = poly_trait_predicate.skip_binder().trait_ref;
151151
let def_id = trait_ref.def_id;
152152
let descr_pre =

src/librustc_middle/ty/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ where
201201
assert!(pos >= SHORTHAND_OFFSET);
202202
let shorthand = pos - SHORTHAND_OFFSET;
203203

204-
decoder.with_position(shorthand, ty::Predicate::decode)
204+
decoder.with_position(shorthand, ty::PredicateKind::decode)
205205
} else {
206-
ty::Predicate::decode(decoder)
206+
ty::PredicateKind::decode(decoder)
207207
}?;
208208
Ok((predicate, Decodable::decode(decoder)?))
209209
})

0 commit comments

Comments
 (0)