Skip to content

Commit c1d244f

Browse files
committed
convert trivial predicates
1 parent fb36c8b commit c1d244f

File tree

11 files changed

+26
-28
lines changed

11 files changed

+26
-28
lines changed

src/librustc_infer/infer/canonical/query_response.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,8 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
670670
self.obligations.push(Obligation {
671671
cause: self.cause.clone(),
672672
param_env: self.param_env,
673-
predicate: ty::PredicateKind::RegionOutlives(ty::Binder::dummy(ty::OutlivesPredicate(
674-
sup, sub,
675-
)))
676-
.to_predicate(self.infcx.tcx),
673+
predicate: ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(sup, sub))
674+
.to_predicate(self.infcx.tcx),
677675
recursion_depth: 0,
678676
});
679677
}

src/librustc_infer/infer/combine.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
308308
self.obligations.push(Obligation::new(
309309
self.trace.cause.clone(),
310310
self.param_env,
311-
ty::PredicateKind::WellFormed(b_ty.into()).to_predicate(self.infcx.tcx),
311+
ty::PredicateKint::WellFormed(b_ty.into()).to_predicate(self.infcx.tcx),
312312
));
313313
}
314314

@@ -400,9 +400,9 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
400400
b: &'tcx ty::Const<'tcx>,
401401
) {
402402
let predicate = if a_is_expected {
403-
ty::PredicateKind::ConstEquate(a, b)
403+
ty::PredicateKint::ConstEquate(a, b)
404404
} else {
405-
ty::PredicateKind::ConstEquate(b, a)
405+
ty::PredicateKint::ConstEquate(b, a)
406406
};
407407
self.obligations.push(Obligation::new(
408408
self.trace.cause.clone(),

src/librustc_infer/infer/sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ 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::PredicateKind::Subtype(ty::Binder::dummy(ty::SubtypePredicate {
103+
ty::PredicateKint::Subtype(ty::SubtypePredicate {
104104
a_is_expected: self.a_is_expected,
105105
a,
106106
b,
107-
}))
107+
})
108108
.to_predicate(self.tcx()),
109109
));
110110

src/librustc_infer/traits/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,16 @@ impl Elaborator<'tcx> {
234234
if r.is_late_bound() {
235235
None
236236
} else {
237-
Some(ty::PredicateKind::RegionOutlives(ty::Binder::dummy(
238-
ty::OutlivesPredicate(r, r_min),
237+
Some(ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(
238+
r, r_min,
239239
)))
240240
}
241241
}
242242

243243
Component::Param(p) => {
244244
let ty = tcx.mk_ty_param(p.index, p.name);
245-
Some(ty::PredicateKind::TypeOutlives(ty::Binder::dummy(
246-
ty::OutlivesPredicate(ty, r_min),
245+
Some(ty::PredicateKint::TypeOutlives(ty::OutlivesPredicate(
246+
ty, r_min,
247247
)))
248248
}
249249

src/librustc_middle/ty/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
3939
}
4040

4141
impl<'tcx> EncodableWithShorthand for ty::Predicate<'tcx> {
42-
type Variant = ty::PredicateKind<'tcx>;
42+
type Variant = ty::PredicateKynd<'tcx>;
4343
fn variant(&self) -> &Self::Variant {
4444
self.kind()
4545
}
@@ -195,7 +195,7 @@ where
195195
})
196196
} else {
197197
let tcx = decoder.tcx();
198-
Ok(tcx.mk_predicate(ty::PredicateKind::decode(decoder)?))
198+
Ok(tcx.mk_predicate(ty::PredicateKynd::decode(decoder)?))
199199
}
200200
}
201201

src/librustc_mir/borrow_check/type_check/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use rustc_middle::ty::cast::CastTy;
2727
use rustc_middle::ty::fold::TypeFoldable;
2828
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
2929
use rustc_middle::ty::{
30-
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef,
31-
ToPredicate, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
30+
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPredicate, Ty,
31+
TyCtxt, UserType, UserTypeAnnotationIndex,
3232
};
3333
use rustc_span::{Span, DUMMY_SP};
3434
use rustc_target::abi::VariantIdx;
@@ -1021,7 +1021,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
10211021
}
10221022

10231023
self.prove_predicate(
1024-
ty::PredicateKind::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
1024+
ty::PredicateKint::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
10251025
Locations::All(span),
10261026
ConstraintCategory::TypeAnnotation,
10271027
);
@@ -1273,7 +1273,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12731273
obligations.obligations.push(traits::Obligation::new(
12741274
ObligationCause::dummy(),
12751275
param_env,
1276-
ty::PredicateKind::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
1276+
ty::PredicateKint::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
12771277
));
12781278
obligations.add(
12791279
infcx
@@ -1617,7 +1617,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
16171617
self.check_call_dest(body, term, &sig, destination, term_location);
16181618

16191619
self.prove_predicates(
1620-
sig.inputs_and_output.iter().map(|ty| ty::PredicateKind::WellFormed(ty.into())),
1620+
sig.inputs_and_output.iter().map(|ty| ty::PredicateKint::WellFormed(ty.into())),
16211621
term_location.to_locations(),
16221622
ConstraintCategory::Boring,
16231623
);
@@ -2706,8 +2706,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27062706
category: ConstraintCategory,
27072707
) {
27082708
self.prove_predicates(
2709-
Some(ty::PredicateKind::Trait(
2710-
trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
2709+
Some(ty::PredicateKint::Trait(
2710+
ty::TraitPredicate { trait_ref },
27112711
hir::Constness::NotConst,
27122712
)),
27132713
locations,

src/librustc_trait_selection/traits/select/confirmation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
532532
obligations.push(Obligation::new(
533533
obligation.cause.clone(),
534534
obligation.param_env,
535-
ty::PredicateKind::ClosureKind(closure_def_id, substs, kind)
535+
ty::PredicateKint::ClosureKind(closure_def_id, substs, kind)
536536
.to_predicate(self.tcx()),
537537
));
538538
}

src/librustc_trait_selection/traits/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
316316
traits::Obligation::new(
317317
new_cause,
318318
param_env,
319-
ty::PredicateKind::WellFormed(arg).to_predicate(tcx),
319+
ty::PredicateKint::WellFormed(arg).to_predicate(tcx),
320320
)
321321
}),
322322
);

src/librustc_traits/type_op.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl AscribeUserTypeCx<'me, 'tcx> {
140140
self.relate(self_ty, Variance::Invariant, impl_self_ty)?;
141141

142142
self.prove_predicate(
143-
ty::PredicateKind::WellFormed(impl_self_ty.into()).to_predicate(self.tcx()),
143+
ty::PredicateKint::WellFormed(impl_self_ty.into()).to_predicate(self.tcx()),
144144
);
145145
}
146146

@@ -155,7 +155,7 @@ impl AscribeUserTypeCx<'me, 'tcx> {
155155
// them? This would only be relevant if some input
156156
// type were ill-formed but did not appear in `ty`,
157157
// which...could happen with normalization...
158-
self.prove_predicate(ty::PredicateKind::WellFormed(ty.into()).to_predicate(self.tcx()));
158+
self.prove_predicate(ty::PredicateKint::WellFormed(ty.into()).to_predicate(self.tcx()));
159159
Ok(())
160160
}
161161
}

src/librustc_typeck/check/method/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
399399
obligations.push(traits::Obligation::new(
400400
cause,
401401
self.param_env,
402-
ty::PredicateKind::WellFormed(method_ty.into()).to_predicate(tcx),
402+
ty::PredicateKint::WellFormed(method_ty.into()).to_predicate(tcx),
403403
));
404404

405405
let callee = MethodCallee { def_id, substs: trait_ref.substs, sig: fn_sig };

0 commit comments

Comments
 (0)